View Full Version : Tiger Backup Script

28th August 2005, 10:44 PM
Hi all, I'm new to the Developer forum but have been working on a backup script to copy over my /Users folder and /Music collection to an external HD using rsync.

The main benefit of doing this using rsync and unix links is that you get full mirrors for each backup, but the storage space only amounts to current files plus any incremental changes. So you can have a string of backup folders named by date/time, each of which contains all of the backed up files, but uses very little storage due to the unchanged files being stored as links.

Anyway I found this quite a useful solution, my backup script is attached to this post, more instructions if you need them at www.tamham.com/software/ (http://www.tamham.com/software/).

And I should add my unix scripting is very elementary, any pointers or tips very welcome ;-)

4th September 2005, 09:46 AM
Nice bit of shell Scripting!

Have you thought about building your own app with this as the basis ?

You could do it with a basic applescript studio xcode project and wrap a lot of it around a do shell script type command use fields etc for input etc...

Must get off my butt and code more thanks for the insperation!


5th September 2005, 09:58 PM
Nevets, thanks for the feedback. When I'm happy with the functionality of the script, I may have a go at replicating it in cocoa.

When putting this together I noticed that the Mac OS X Finder *does not* correctly report the size of folders which include unix links (anyone know why this is?). So in the Finder it might seem that your backup folder is getting very large, but actually it's not. The du command run at the end of the script gives the correct size used, and Get Info in Finder returns the correct amount of free disk space.

6th September 2005, 09:33 AM
Yeah I was thinking if you wanted to make it a little nicer and keep it cli based
you could do something like this


echo Enter Path to folder you want backed up:
read up
echo Name and path to backup volume

Then use "volume" and "up" as your VARIABLES

(I tend to work in bash now that apple have decided yet again to change!)

6th September 2005, 10:56 AM
Originally posted by Nevets_Anderson@Sep 4 2005, 09:46 AM
Have you thought about building your own app with this as the basis ?
you could also use Platypus to wrap the script into an executable file ...

I use it for my PHP and Applescripts. :thumbup:

24th September 2005, 01:38 AM
I was using rsnapshot which is a rsync based, incremental backup script written in Perl.


However, its not a good idea to use rsync as the incremental backup program on Mac OS X. It is because the version of rsync that comes with the OS does not handle resource forks and metadata properly:
- on Panther, resource fork support in rsync does not exist.
- on Tiger, rsync has a critical bug when handling files with resource forks. The bug makes rsync generate a new copy of files and directories with resource forks in each increment.

As a result I stick with ditto for manual backup.... :( Anyone knows of a working version of rsync for Tiger?

25th September 2005, 08:30 PM
Originally posted by McDull+Sep 24 2005, 01:38 AM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (McDull &#064; Sep 24 2005, 01:38 AM)</td></tr><tr><td id='QUOTE'>I was using rsnapshot which is a rsync based, incremental backup script written in Perl.[/b]
Thanks McDull, I&#39;d read Mike Rubel&#39;s guide but I hadn&#39;t come across rsnapshot, which does everything I need :)

<!--QuoteBegin-McDull@Sep 24 2005, 01:38 AM
Anyone knows of a working version of rsync for Tiger?[/quote]
I&#39;ve seen various patched versions around which supposedly copy resource forks correctly, but that feature isn&#39;t critical for me so I&#39;ll wait for the official fix.

26th October 2005, 06:58 PM
Man, I wish Apple would retire the resource fork thing, and quick&#33;

Every time I want to copy a file onto someone&#39;s USB drive, I&#39;ve gotta go into Terminal and delete all the ._ files, (or else leave the Windows user with a confusing set of files).

Is anyone with me?

I backup parts of my ~ folder to another mac using rsyncx (http://www.versiontracker.com/dyn/moreinfo/macosx/16814&mode=feedback&vid=All) with great success, although I&#39;m running 10.3.9.

I also backup parts of my ~ folder to my FAT formatted iPod using rsync - at the moment I don&#39;t worry about the resource forks, although I am considering reformatting my hard drive as UFS and then setting rsync to only copy ._ files that end in " alias" or ".app" or ".lnk"