Using RSync to Backup

I use RSync to backup my systems. I backup the following.

  • Backup my laptop to a small server at my home
  • Backup my web host to my server at home
  • Backup my CVS files at home to a second hard drive

Here is the rsync command I use to sync to a windows share.

sudo rsync -rvh --size-only --delete \
--exclude-from=/home/joel/exclude.lst \
/home/joel /mnt/jay/ubuntop/

Here is a general RSync command.

rsync -avh --delete -e ssh source/ \
username@remotemachine.com:/path/to/destination/

If you are using rsync with a Windows share as the target, the -a option might not work since Windows doesn't support unix file permissions and such. Instead, just use the -r option. Also, lose the SSH option and rsync to a mounted windows share.

rsync -rvh --delete /source/ /destination/

On my laptop I want to limit the bandwidth it uses so it doesn't slow me down.

--bwlimit=KBPS

Also, I often want to exclude a few things, which I can do with the following.

--exclude=

For some reason, I get errors when using rsync with a Windows share as the target. Even though I can create directories and files there as a user, I have to execute rsync as root. Not sure why this is.

On a windows share, the date and timestamps don't seem to work consistently. As a result, I use the –size-only option so that rsync looks only at the size of the file and not at the timestamp. You could probably use crc checks as an alternative, but that probably adds a lot of time.

comments powered by Disqus
linux/using_rsync_to_backup.txt · Last modified: 2020/06/01 22:53 (external edit)