Switch to using rdiff-backup for backups of / instead of rsync?

I usually use rsync to do backups, with a command like this:

rsync -avxz -e "ssh" --exclude ".gvfs" --numeric-ids / /media/Backup/slash/

How can I convert the arguments I use with rysnc to rdiff-backup?

Update:
OK, I made myself a "shopping list".

rsync flags: avxz = rlptgoDvxz
rdiff-backup flags (not complete): --preserve-numerical-ids  --exclude-other-filesystems --include-symbolic-links  --include-special-files


Shopping list:
   rsync flag                  rsync explanation                      rdiff flag?
-----------------------------------------------------------------------------------------------------------------------------
   -r, --recursive             recurse into directories
X  -l, --links                 copy symlinks as symlinks   # done by --include-symbolic-links (I hope)
   -p, --perms                 preserve permissions
   -t, --times                 preserve modification times
   -g, --group                 preserve group
   -o, --owner                 preserve owner (super-user only)
X      --devices               preserve device files (super-user only)   # Hopefully taken care of by --include-special-files
X      --specials              preserve special files   # Hopefully taken care of by --include-special-files
X  -x, --one-file-system       don't cross filesystem boundaries   # Done by --exclude-other-filesystems
X      --numeric-ids           don't map uid/gid values by user/group name   #Done by --preserve-numerical-ids

So, what is left is how to preserve Permissions, Ownership, Groups, Modified times, and be recursive. I'm not sure if rdiff-backup already does this, since this is a backup, I need to be sure everything is taken care of, not just think everything is taken care of.

I've tried it a few times, but I haven't stumbled on the formula yet: I used

rdiff-backup -v5 --preserve-numerical-ids  --include-symbolic-links  --include-special-files --exclude-other-filesystems  "root@2001:470:e89d:9ab6:21b:24ff:fe75:5822::/" /media/Backup/rdiff/bjorn-laptop/one_ext4/

to backup and

rdiff-backup -r now -v5 --preserve-numerical-ids --force /media/Backup/rdiff/bjorn-laptop/one_ext4/ "root@2001:470:e89d:9ab6:21b:24ff:fe75:5822::/media/2f52fa73-b3a6-46ef-8e1b-e82d983b0b7f_/"

to restore. After that, I tried modifying /etc/fstab on the restore with the new UUID and updating grub (with the new UUID) but I got errors about /dev, /sys, & /proc not being there. How can I use rdiff-backup so I only have to restore the backup, change /etc/fstab (on the restore) and update/install grub?


Solution 1:

There is a good example how to use rdiff to back up the root partition: http://manual.aptosid.com/en/sys-admin-rdiff-en.htm

Personally I use the following syntax to back up:

rdiff-backup --exclude-sockets --exclude '/media/*/*' --exclude '/mnt/*' --exclude '/proc/*' --exclude '/sys/*' --exclude '/tmp/*' / {backup-dest-dir}

And the following syntax to restore: rdiff-backup -r now {backup-dest-dir} {restore-dir}

You have to run rdiff-backup as root to remain permissions, ownership, groups, modified times, etc. I can ensure rdiff-backup takes care of all your requirements.

Used it today to restore the root partition after a failed upgrade from Ubuntu 8.04.4 --> 10.04.4 --> 12.04 (dev).

Solution 2:

I think you are being bit by this bug:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=397413

Assuming your target disk is mounted at /mnt/foo You probably just need to do

mkdir /mnt/foo/dev /mnt/foo/sys /mnt/foo/proc 

There's also a patch for this bug at http://thread.gmane.org/gmane.comp.sysutils.backup.rdiff-backup.general/6452, but it will try to list remote filesystems.