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.

One Response to “Using rsync to maintain backups on Linux”

  1. Setting up and using NFS on Ubuntu | kieran barnes | kieranbarnes Says:

    [...] you just need to devise a way of maintaining backups. Edit: Try my article on Using rsync to maintain backups on Linux Bookmark it del.icio.us | Reddit | Slashdot | Digg [...]

Leave a Reply