Scripts and Programs

There are scripts and programs available to facilitate the use of this solution:

A Manual Example

You want to copy your disk/backup a partition.
Assuming you have created a partition on another disk and mounted it (in this example /mnt/usbharddrivemain):

  • Duplicate a partition:
  rsync --progress --stats -avxzl --exclude "/mnt/usbharddrivemain/" --exclude "/mnt/usbharddriveboot/" --exclude "/usr/portage/" --exclude "/proc/" --exclude "/root/.ccache/" --exclude "/var/log/" --exclude "/sys" --exclude "/dev" --exclude "tmp/" /* /mnt/usbharddrivemain
  
  • Duplicate a partition and delete files that are no longer current (that have been deleted from the source partition):
  rsync --progress --stats --delete -avxzl --exclude "/mnt/usbharddrivemain/" --exclude "/mnt/usbharddriveboot/" --exclude "/usr/portage/" --exclude "/proc/" --exclude "/root/.ccache/" --exclude "/var/log/" --exclude "/sys" --exclude "/dev" --exclude "tmp/" /* /mnt/usbharddrivemain
  
  • To backup /boot (another partition):
  rsync --progress --stats -avxzl /boot /mnt/usbharddriveboot
rsync --progress -avxzl --stats --delete /boot /mnt/usbharddriveboot
  

To restore, you can boot from the second hard drive or use a Live CD. Repeat the previous commands by changing the source and destination, for example: /mnt/usbharddrivemain /mnt/driveToRestoreTo.

  • You may encounter problems with certain files, such as LDAP databases. To work around this issue, use the ‘Sparse’ option:
  rsync -avxzl --sparse /var/lib/ldap/mdb/db/data.mdb /mnt/usbharddriveboot
  
  • To synchronize via SSH:
  rsync -e ssh -av --delete "/rsync" remote:backupdir
  

Resources

Last updated 06 Sep 2013, 08:43 CEST. history