wiki'd

by JoKeru

Raspberry Pi Backup & Restore

[cc lang='bash']
# backup
\$ dd if=/dev/mmcblk0 | gzip > raspi.img.gz

# restore backup
\$ gunzip -c raspi.img.gz | dd of=/dev/mmcblk0
[/cc]

INFO: /boot is formatted vfat, / is formatted f2fs (in case you need to change something before restoring to card)
[cc lang='bash']
pi@raspbmc:\~\$ cat /etc …

DF & MTU

By default ping in any Linux-based system is sent with Don’t Fragment (DF) bit set.
Here is what you get by default ping in Linux:
* Don’t fragment bit (in echo request) – set
* IP packet size – 84 bytes (20 bytes IP Header + 8 bytes ICMP Header + 56 data bytes …

Optimizing Servers and Processes for Speed

The basic idea of these tools is to control how much CPU is devoted to each process, and also how much Disk IO/Disk traffic is given to each process.

nice- run a program with modified scheduling priority
renice- alter priority of running processes
ionice- set or retrieve the I …

HP Smart Array (cciss)

[cc lang='bash']
\$ dmidecode -t system
# dmidecode 2.9
SMBIOS 2.7 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: HP
Product Name: ProLiant DL160 G6
Version:
Serial Number: CZJ2041N5P
UUID: C74FBB01-FE8E-11D5-84D0-E4115BE24033
Wake-up Type: Power Switch
SKU Number: 590161-421
Family:

\$ lspci | grep -i raid
04:00.0 …

RAID Utils

[cc lang='bash']
# Get controller type and model - Hardware RAID

\$ lspci | grep -i raid
1b:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2208 [Thunderbolt] (rev 05)
# MegaRAID SAS is the current high-end RAID controllers series by LSI. It is fully hardware RAIDs controllers supporting RAID5, at …

BASH History with Date

[cc lang='bash']
\$ cat \<> /root/.bashrc
export HISTTIMEFORMAT='%F %T '
export HISTSIZE=10000
EOF
\$ logout
[/cc]

RoundCube WebMail

[cc lang='bash']
\$ cd /var/lib/
\$ wget http://sourceforge.net/projects/roundcubemail/files/roundcubemail/0.9.5/roundcubemail-0.9.5.tar.gz/download
\$ tar -xzf download; rm -f download
\$ ln -s roundcubemail-0.9.5/ roundcubemail
\$ chown -R root:root roundcubemail/
\$ chown -R www-data:www-data roundcubemail/temp/ roundcubemail/logs/

\$ mysql -e …

System Performance Monitoring with collectd

[cc lang='bash']
\$ #echo 'statistics-channels { inet 127.0.0.1 port 8053; };' >> /etc/bind/named.conf.options
\$ #rnds reload

\$ apt-get install collectd-core
\$ cat \< /etc/collectd/collectd.conf
# http://collectd.org/documentation/manpages/collectd.conf.5.shtml
Hostname "wiki.jokeru.ro"
BaseDir "/var/lib/collectd"
PIDFile "/var/run/collectd.pid"
PluginDir …

Shrink Amazon EBS Root Volume

  1. Snapshot the root volume (this step is done as a backup)

​1. Create a new ebs volume (smaller than current one)

​2. Stop the instance and detach the current root volume

​3. Attach both volumes to another running instance
- new /dev/sdf - /dev/xvdf on the instance
- old /dev/sdg …