Backing up partions under *nix

dd is your man here. Replace /dev/disk for the disk you are interested in i.e. sda, sdb :

dd if=/dev/disk of=/path/backup

This will create a full backup of your partition i.e. /dev/sda1:

dd if=/dev/disk_partition of=/dev/backup

You can compress the backup using gzip:

dd if=/dev/disk | gzip -c9 > /path/backup.gz

And to restore it:

gunzip -c /path/backup.gz | dd of=/dev/disk


Written on September 3, 2008