You are here

Linux Backup solutions

Some resources for setting up backups:

Comparisons

Duplicity

Rsync

rsync -aAXv /* /path/to/backup/folder --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*",/lost+found}
  • Copy entire file system hierarchy from one drive to another superuser.com/…
  • Recommended script:
rsync -WavxHAX --delete-excluded --progress \
  /mnt/from/ /mnt/to/
  --exclude='/home/*/.gvfs' \
  --exclude='/home/*/.local/share/Trash' \
  --exclude='/var/run/*' \
  --exclude='/var/lock/*' \
  --exclude='/lib/modules/*/volatile/.mounted' \
  --exclude='/var/cache/apt/archives/*' \
  --exclude='/home/*/.mozilla/firefox/*/Cache' \
  --exclude='/home/*/.cache/chromium'\
  --exclude='/home/*/.thumbnails' \
  --exclude=.cache --exclude Cache --exclude cache #these last three prevent deletion of directories

Rdiff-backup


Solution for Root Filesystem (using rsync)

  • Note this needs root ssh access in /etc/ssh/sshd_config
    • comment out PermitRootLogin without-password & add PermitRootLogin yes & service ssh restart
  • Options:
    • --numeric-ids or they will be translated for the host system of the hard drive
    • -x one filesystem -W don’t try to be clever with sending partial files
    • -H hard links -A ACL’s -X extended attributes
rootdest=root@john:/mnt/
sudo rsync -avxWHAX --delete --numeric-ids -e "ssh -c arcfour" /* $rootdest \
  --exclude='/home/*' \
  --exclude='/dev/*' \
  --exclude='/proc/*' \
  --exclude='/sys/*' \
  --exclude='/tmp/*' \
  --exclude='/run/*' \
  --exclude='/mnt/*' \
  --exclude='/media/*' \
  --exclude=/lost+found \
  --exclude='/var/run/*' \
  --exclude='/var/lock/*' \
  --exclude='/oldboot/*' \
  --exclude='/etc/fstab' \
  --exclude='/var/cache/apt/archives/*'
  • Before running the above script, copy /boot to /oldboot in the destination system and back up fstab
  • After running it, chroot into the updated system and run update-grub
  • Note that this assumes /home on a separate filesystem

Solution for home directory

homedest=root@john:/homeback/
rsync -avxWHAX --delete --numeric-ids -e "ssh -c arcfour" /home/* $homedest \
  --exclude='/home/*/.gvfs' \
  --exclude='/home/*/.local/share/Trash' \
  --exclude='/home/*/.mozilla/firefox/*/Cache' \
  --exclude='/home/*/.cache/chromium' \
  --exclude='/home/*/.thumbnails'