With the ubiquity of mobile computer and especially their dominance among Apple’s product offerings, it’s probably a very common set-up for people to use a MacBook both at home and at the office. This gives you a lot of flexibility and avoids having to maintain two installations — which can take a lot of time, depending on the amount of customization you’re applying to your machine. You bring your machine and therefore never have to sit down at an out-of-date computer.
There’s one problem though: Do you also carry along your time machine backup? Because if you don’t, and you spent a significant amount of time at either location, there will be large gaps and opportunities for failure in your backup schedule. (Yes, there’s mobile time machine but I see that as an option when you’re really on the road. A same disk backup is not truly a backup, it’s more like “Trash on steroids”.)
So what are the options? You could carry an external disk around and use that for backups. The problem with this is, though, that it takes a lot of discipline to hook it up every time you sit down in one place in order for the hourly time machine backups to happen. Part of the beauty of time machine is that, if it’s configured to back up to a network volume, you never have to do anything for it to kick in. All you need to do is enter you wifi zone.
Another reason an external disk is not ideal is the fact that it’s not redundant in itself. It’s just a single disk and single disks fail. Ideally, a time machine backup sits on a RAID-5 or some other redundant configuration – none of which is going to be portable.
In my opinion, the ideal solution to this is to have a time machine set-up at each location where you spend a significant amount of time and which you get switched to automatically on joining the respective network. When I saw the macosxhints article about using two time machine backups a few days ago, I knew that all the bits were there to set this up. However, I didn’t want to install extra tools like the article describes (MarcoPolo) and therefore I wrote a little ruby script that does everything automatically.
autotmlooks at your system.log to determine if the last backup failed
if it failed,
- will go through the list of configured servers to look for an alternative
- if multiple servers respond to pings,
autotmwill pick the fastest one (your office server may be visible via a presumably slower VPN connection for example but you want to avoid backing up there from home)
- if your last backup was successful but the server is not available anymore
autotmwill check for alternatives and pick the fastest one, as described above
So essentially, all you have to do is set up two (or more) time machine backups for you machine and then record their details in the config file. The LaunchDaemon will then trigger
autotm every 30 minutes to check if it needs to switch time machine targets without any action required on your end.