rsync as backup???

Discussion in 'Mac OS X Server, Xserve, and Networking' started by catherder, Dec 3, 2009.

  1. catherder macrumors newbie

    Joined:
    Dec 3, 2009
    #1
    hello, i've looked around the forums and rsync man pages, tutorials, etc. and still have a question: why would anyone use rsync as a backup system? when i say backup system, it should allow for you to restore a lost file one day or 25 days ago and i dont understand how rsync does that, or even if it can.

    i'm taking over a sys admin role and the previous admin used rsync to back up the system. my understanding of rsync is that it will create a copy of a source directory onto a destination directory, essentially creating a one-time snapshot mirror of the source. granted the algorithm is pretty neat w/ block and rolling checksums, but because every time it runs, it makes the destination look like the source, i dont see how it will allow for restore of files done before the last rsync was run.

    nowhere could i find if incremental backups are stored so that i could potentially go back to say 2 wks ago and restore a file that was accidentally deleted on the source side, or how rsync actually stores the files on the destination side using the original comparison and a subsequent differential result - is it simply a file structure like the source where i can view and open files?

    confused....explanation would be appreciated. as an aside, what should be used for a good backup system? "rdiff-backup"? anyone have an opnion on?
    thx
     
  2. Serif macrumors regular

    Joined:
    Jul 10, 2008
    Location:
    UK
    #2
    Actually rsync can be used to create a very useful set of daily backups with the functionality that you require, but it requires a little more scripting to do this, and it only really makes sense if the set of files change relatively slowly; great for backing up the files on a multisite web server, not so good backing up a database server.

    The way I do this is to structure daily backups so that each is rooted in its own folder, typically named after the date, something like 20091202. Once you've created the folder for the current day, recursively walk the previous day's backup folder creating the same structure of nested folders and creating hard links back to actual files in the previous backup. That way a file which doesn't change for months only takes up space for its contents once for that instance; it just has multiple links.

    Once you have that structure in place, use rsync to backup the current live data into the backup folder. In a slowly changing environment it should have minimal work to do; essentially just the difference set between the live data and the previous day's backup. This way you have what is in effect daily snapshots of the live system going back as far as you have disk space to hold them. I've used this sort of system for years to manage backups on virtual web servers so that when someone realises they made a change they shouldn't have several months earlier, I can easily go back and recover the last version before the change.

    In an OS X environment, just remember that the -E flag might be needed to preserve resource forks of files.
     
  3. ebookmark macrumors newbie

    Joined:
    Jan 6, 2010
    #3
    I agree with Serif
    rsync requires a little more scripting :apple:
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    rsync has the -b (--backup) argument that can be used to store archived versions of deleted files. It's what I've used and what CCC uses for incremental backups of changed/deleted files. I use "simple" one line rsync commands to do backups. I don't really feel it requires more scripting.
     

Share This Page