I have a main backup server running rsnapshot, with ~2TB of backups stored on it. After the nightly backups, I copy the contents of the rsnapshot directory to an offsite server, using rsync -aH --delete /source /dest
. However, this seems to copy the entire contents of the backup directory every night, as the offsite copy takes ~9 hours to complete.
I assume my rsync command doesn't have the right switches, but there may be something else I'm missing. Any ideas?
I believe you just copying the same files multiple times. Hope these details on how does the rsnapshot work will help resolve the problem.
Here is the most important point:
The issue here is that if you want to keep a copy of the whole versioned backup on a remote location, you're going to have to handle the fact that rsnapshot rotates the directory names whenever it runs, so you'll end up with a fresh copy of the most recent backup being copied over every time.
You can alter the way rsnapshot runs in terms of when it performs the copies and when it rotates (renames) the directories and you can also execute scripts at various points in rsnapshots execution cycle, like before or after a specific backup point is run.
There's a helpful post here:
https://stackoverflow.com/questions/10691522/mirror-rsnapshot-backup-directory
Another approach is to get a copy of rsnapshot on your second machine and have it backup the contents of /snapshot_root/daily.0 AFTER your main back has been completed. This, in conjunction with the correct rsync flags will give you an incremental copy of your latest backups.
There is an option called
--link-dest
which does what you need. When this parameter points to your latest backup it will only copy files from src to dest if src is different from the data already in your last backup (referenced by--link-dest
) ; if the data is the same it will create a symlink instead thereby giving you a whole versioned backup.I use this option to create daily snapshots locally on a separate disk, for remote backup you will need to modify it to ensure the symlinks will be created correctly on the remote system. I would recommend adding some rotation of old backups and an initial standard backup must be created to compare against.