Sunday, August 15, 2010

Linux Backup Tips

There is option in linux itself to take the image backup in multiple ways, please check as follows

Backup Methods
1. Taking a snapshot of hda to hdb
dd if=/dev/hda of=/dev/hdb

2. Taking hda as the image file
dd if=/dev/hda of=/path/to/image

3. Taking hda as the zip file
dd if=/dev/hdx | gzip > /path/to/image.gz

MBR backup
1. To take the MBR backup
dd if=/dev/hda(1) of=/path/to/image count=1 bs=512

Restore Methods
1. To restore the Backup from image file  
dd if=/path/to/image of=/dev/hda

2. To restore the backup from the ZIP file
gzip -dc /path/to/image.gz | dd of=/dev/hda

MBR restore
1. To restore the MBR image backup
dd if=/path/to/image of=/dev/hda(1)
Add "count=1 bs=446" to exclude the partition table from being written to disk. You can manually restore the table.