kieranbarnes these are the things i learnt today

Using rsync to maintain backups on Linux

Posted on April 22, 2008

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.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Related posts:

  1. Setting up and using NFS on Ubuntu
    Network File System, NFS, has been around since Noah first networked his ark. Setting up...
  2. Cleaning up Deleted Items Automatically from Exchange
    Do you want to automatically delete Deleted Items in Outlook/Exchange or delete any type of...
  3. Permanently mount a Windows share in Linux
    Sick of manually mounting a Windows share on Linux with "mount" for it to drop...
  4. NTLM Authentication (Active Directory) on Apache (Linux)
    Here is a quick guide to enabling NTLM authentication for Apache 2. I generally use...
  5. FreeTDS installation directory is not a FreeTDS installation directory
    I recently discovered an error whilst trying to (re)install an older PHP version on a...

What this article 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.

Filed under: Linux Leave a comment