RSync Command for Home Directory Backup on Ubuntu/Linux
Mostly for my own reference – this is the command I use to back my home directory on my desktop. Both locations are local, so there is no copying over SSH for this first one.
rsync -rougv --archive --delete-excluded --ignore-errors --exclude=*.gvfs* /home/andrew /backup/
Below is the command that I use for each user on my main file server. This copies over SSH, so I have SSH keys on the destination server so I can run this in a cron job, and it won’t get hung up with a password prompt.
rsync -rougv --archive --delete-excluded --ignore-errors --exclude=*.gvfs* /home/user1 bckup@server-02:/media/external/backups/server-01/
From the man page, here is an explanation on all the options I use:
- -r, –recursive recurse into directories
- -o, –owner preserve owner (super-user only)
- -u, –update skip files that are newer on the receiver
- -g, –group preserve group
- -v, –verbose increase verbosity
- -a, –archive archive mode; equals -rlptgoD (no -H,-A,-X)
- –delete-excluded also delete excluded files from dest dirs
- –ignore-errors delete even if there are I/O errors
- –exclude=PATTERN exclude files matching PATTERN (so it doesn’t copy any SSHFS-mounted directories on my system)
This entry was posted on Sunday, May 2nd, 2010 at 6:01 pm and is filed under Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.