Questions? Feedback? powered by Olark live chat software





Go to checkout



Duplicate drive in UNIX/Linux over network
  To duplicate unix partition over the network run the following command sequence
on a target server :
# nc -l -p 12345 | dd of=/dev/sdb
on a src_server
# dd if=/dev/sda | nc target_server 12345

to check duplication progreess :

Set up incremental backups using rsnapshot
For example we use Debian distrib and package manager
First install required packages

#apt-get install rsync rsnapshot

edit rsnapshot config file: 

#vi /etc/rsnapshot.conf

We will backup folder /home/user1/public_html to folder user1/
backup  root@server:/home/user1/public_html      user1/

interval        hourly  2

interval        daily   7
interval        weekly  4
interval monthly 1
add cron tasks 

0 */12         * * *           root    /usr/bin/rsnapshot hourly
30 3          * * *           root    /usr/bin/rsnapshot daily
0  3          * * 1           root    /usr/bin/rsnapshot weekly
30 2          1 * *           root    /usr/bin/rsnapshot monthly

rsnapshot configtest
Create LVM backup using snapshot
To create a backup of an LVM  first create a snapshot, 2Gb snapshot size will be sufficient to keep track of aprox. daily change in case of low-medium disk activity on a volume.
#lvcreate -s -L 2G -n yourlvm_snapshot /dev/yourvolgroup/yourlvm
 Note - enter your volumegroup and lvm names
 Note2: you should have enough free space in your volume group, so try always to leave at least 5-10gig of free unalocated space when creating LVMs
Create an image and compress it using fast or high compression tools (lzo is fast, gzip/bzip is more CPU-demanding, but compression is better)
 #dd if=/dev/yourvg/yourlvm_snapshot | bzip2 | dd of=/var/backups/xen_vps/domU.bz2

Remove the snapshot when backup is complete
#lvremove /dev/youvg/yourlvm_snapshot

 To recover from backup run:  
#bunzip2 /var/backups/xen_vps/domU.bz2 | dd of=/dev/vg0/domU conv=sync,noerror bs=512
Bulk IP address add in Linux
In case if you need to add a range of IPv4 IP address in linux, one can run the following shell script:
#for i in {1..10}; do ip a a a.b.c.$i/24 dev eth0 ; done;
 This can be added to   в rc.local to add addresses at OS boot. 

 To add a range of  IPv6 from a list in a file run this: 

cat /home/data/hosts | awk '{print $1}' | xargs -I {} ip -6 a a {}/64 dev eth0