Using rsync to maintain backups on Linux

April 22nd, 2008
No Gravatar

Following on from my previous article, regarding Setting up and using NFS on Ubuntu, here’s how I keep backups for quite a few clients.

On a particular site I maintain a single backup server that several clients backup to on a nightly basis.

rsync is great. Its one of those incredibly old, under rated and under used tools that come with pretty much all Linux distros.

The following rsync command takes a backup of a directory on a server and backs it up to another whilst keeping a backup of orphaned/deleted files over NFS.

rsync -ahvz --exclude=*.log --backup
--backup-dir=<DESTINATION SERVER SHARE>`hostname`/orphans-`date +%Y-%m-%d`
--delete --delete-excluded <DIRECTORY TO BACKUP>
/<DESTINATION SERVER>`hostname`<DIRECTORY NAME>

Simple as.

Note: Remember to clean up your orphaned files on a weekly/regular basis or your hard drive will soon fill up.

Bookmark it del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Propeller | Yahoo


Was this post useful to you? Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the Linux category.

Leave a Reply