kieranbarnes Independent PHP, WordPress & CubeCart Programmer

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.


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. MySQL: Can’t get hostname for your address
    Can''t remotely login to your shiney, new MySQL server due “Can’t get hostname for your...
  3. Active Directory DHCP Authorisation Issues
    So you just deleted a DHCP server in your Active Directory site and can't authorise...
  4. NTLM Authentication (Active Directory) on Apache (Linux)
    Here is a quick guide to enabling NTLM authentication for Apache 2. I generally use...
  5. Messing with time and date on Linux
    Some Linux distros don't come with time synchronisation utilities, even though Windows has done it...

Posted by Kieran


Comments (1) Trackbacks (1)
  1. Its one of those incredibly old, under rated and under used tools that come with pretty much all Linux distros.


Leave a comment

(required)