Unfortunately, this isn’t a way to fully backup your Mac, but it’s a great and cheap (free!) way to backup all your Mac data.ADHERER
Okay, so this won’t allow you to recover OSX from a total meltdown. But it will help. And it is a great way to safeguard your data, as well as make it available to your LAN via your Windows Home Server. But the reality is that OSX’s ways of backing up its OS are a mixed bag of delight and hurt. I’ve tried setting up mountable drive images on my WHS box for TimeMachine to use, but it just turns out to be impractical (besides, TimeMachine doesn’t allow restores over the LAN… remember that when you’re looking into purchasing a TimeCapsule). And in the end, the only good way to backup your OSX is onto a locally-connected external drive. Even TimeCapsule won’t let you restore a full OSX partition. But that’s a discussion for another day. Today we’re talking about data! Specifically iTunes data!
My method for fully backing up my Mac Mini is to have an external drive and use TimeMachine. It’s easy, invisible, would let me restore from a disaster, and it’s practical. Somewhat. Here’s my point on that. I use a Drobo for my main drive. The Mac Mini isn’t fast itself, so its drive doesn’t need to be either. It just needs to be stable, solid, and LARGE! My external TimeMachine drive is 1TB, so I don’t know what I’ll do when my data runs over 1TB. Perhaps I’ll limit the TimeMachine backups to remove iTunes from the mix, since I’m backing up to the WHS. But that’s a worry for another time.
So, here we go. The method I employ is Automator, scheduled with cron. Many of you Mac-heads out there are probably scoffing at my use of Automator, but the reality is that it’s very easy to use for some tasks. And the meat of the backup is actually a shell script within the Automator job. Let’s take a look at it.
And that’s it. Simple, right? The Automator task is 3 steps. The first 2 connect me to my WHS box (named acerhome, obviously) and it’s shared folder named “Music”. I could have added a step to disconnect the share, but it’s really not necessary in my opinion.
The magic happens in the third step. Here I run Shell Script commands; specifically 3 commands. The first and third are just housekeeping where I spit the date and time to a log file. I do this before and after so that I can be assured that the backup completed and also so that I can see how long the backup took.
The real meat of this is in the rsync step. Those of you unfamiliar with rsync, I won’t go into too much detail as there are all manner of websites out there with plenty of information about this. But I’ll go over the basics.
rsync is a robust way of copying data from one location to another. It’s claim to fame is in the existence of an rsync server (not necessary to use rsync) which allows for faster backing up over a network. My WHS box isn’t running an rsync server (yet) so I’m not taking advantage of that, but it still works perfectly.
The parameters I’ve passed to rsync are the “a” and “v” parameters which tell rsync to “archive” (copy) the contents of the first folder to the second. The “v” parameter is the “verbose” trigger, which tells rsync to tell me everything it’s doing.
Next, I specify the “from” folder and the “to” folder. The trailing slash is important as it tells rsync that these are folders, not files.
The last bit that starts with the “>>” tells the shell script to store the output in the iTunesBackup.txt file on the WHS server. This is so that I can go back and see what happened later.
That’s pretty much it. This Automator action will connect to the Music share on my Windows Home Server and then copy everything that’s changed (and only what’s changed) from the iTunes music folder to it. If I want to delete from the WHS box the things that no longer exist on the Mac Mini, I can add in the rsync parameter “—delete” (2 dashes).
But for now, I want this to be a failsafe for me, keeping things that I might have accidentally deleted. Of course, my TimeMachine backup serves that purpose too.
Remember the saying in backup: “nothing exists until it exists in 3 places.”
From here, it was easy to clone this to backup my movies, TV shows, and photos. I just copied the Automator action, renamed it, and changed the locations of the “Get Specified Servers” action as well as the locations in the rsync step of the Shell Script. Easy-peasy.
Next time, I’ll discuss the use of cron to schedule this job so that you can just set it and forget it.

One Comment on Back Up Your Mac to a Windows Home Server