Time machine is not perfect! A mobile backup solution for OS X

There's this rule that drives fail and stuff must be backed up.

My main operating system is Apple's OS X. OS X has a backup infrastructure called Time Machine. Time Machine is a way to do a version control on the whole file system. In layman's terms: if you delete a file, you will have a version saved. Or if you mess up a document, you can recover an old version from the Time Machine. This is how the interface looks:

Also if you mess up the OS by installing something stupid, you can recover the whole OS to a state that was for example 1 hour ago. A week ago I had to test this option, because by accident I destroyed some virtual network interfaces and was too lazy to try to fix them manually. This requires an installation cd and then the whole hdd is restored. 120 gb in 50 minutes. I thought it could figure out what to reverse and do it faster without an installation cd, but I guess this is how stuff works. It worked perfectly however.

I have a Time Machine router from Apple. It's a router with a hdd inside it. Backup/restore happens via wi-fi. It works perfectly.

Note: when restoring the whole hdd to an old state, you should link the laptop and the router with a cable. This cuts the restore time in half (10 mb/s on wi-fi, 20 mb/s with cable).

Drawbacks: when a drive fails, I need an installation cd, new hdd, screwdrivers to change the drive and a lot of time for the restore operation (1 hour in my case). This solution is not mobile. The router is big, so I can't take it with me on the road.

Why would I want to have a mobile backup solution?

Well, I have an SSD drive. They tend to fail quite often and without warning. What would happen if I have work abroad and need a laptop and drive that sould not fail, or at least have a backup option? Should I bring a spare hdd, screwdriver, installation cd and the bulky router?

The mobile backup solution

No, there's a better option. Use a drive-cloning software that clones the whole SSD to an external HDD via usb for example. If the SSD fails, I don't even have to change the drives. OS X can boot from the USB drive easily, so I don't need a screwdriver. No downtime, no 1 hour restoration. Just reboot and the new drive kicks in. Well, it's not going to be as fast as the SSD:

I have a 120gb SSD with a 750 gb HDD for a mobile backup. The backup is 120gb, 200gb if I want some history of the most changed files (yes, the software can even do versioning and incremental backup). What should I do with the rest? Split the drive and have some extra space. Now I have a mobile backup with enough space to bring a ton of music or TED hd lectures.

The two softwares I know that can do that are Carbon Copy Cloner (ccc) and SuperDuper! (yes, the exclamation mark is part of the name). CCC is free, that's what I use. Easy to setup. I did all in an hour. I even rebooted to see whether the backup drive would work. It worked like a charm. It copies with around ~30mb/s.

I have not tested SuperDuper!, but it has great reviews, especially the support, they say, is awesome.

Install Snow Leopard (Mac OS X 10.6) from USB and restore only user files from Time Machine

Install Mac OS X 10.6 from a USB memory stick.

Here’s a tutorial on how to install Mac OS X from a USB stick.

Restore only user data from Time Machine

So now comes the restoring. I wanted a clean install – the last installation was pretty messed up.

Now is the time to say that I have a Time Machine for backing up stuff. I didn’t want to restore any system stuff, neither I wanted to restore users and their settings. I just wanted to restore ~/Desktop, ~/Documents, ~/Downloads, ~/MyFiles.

This came out to be VERY HARD.

When installing the OS, the installer asks for a Time Machine, but I said NO, cause I was afraid that it would restore more than I wanted it to.

After the installation was complete I launched Time Machine and tried to go back. I had the snapshots but couldn’t restore them because the owner of the files no longer existed.

With a lot of manual copying I managed to move the data back to my harddrive. Now I had to fix the permissions. Using Mac OS X for that could prove to be impossible.

The console

Going to the console helped a lot.

First to change the owner of a directory:

$ sudo chown -R mstoynov Desktop/
$ sudo chown -R mstoynov Documents/
$ sudo chown -R mstoynov Downloads/
$ sudo chown -R mstoynov MyFiles/

Some of the operations may fail with:

chown: Desktop/web/UC.class: Operation not permitted

The problem most probably resides in some flags being set up. Most probably uchg.

To see whether any files have uchg anywhere in a directory, I did:

$ ls -lOR Desktop/ | grep uchg
-rwxrwxr-x  1 502   staff  uchg   4228 29 Мар  2003 GrandeProjecto.jpx
-rwxrwxr-x  1 502   staff  uchg   1676 18 Авг  2003 GrandeProjecto.jpx.local
-rwxrwxr-x  1 502   staff  uchg    832 29 Мар  2003 GrandeProjecto.jpx.local~

To fix the uchg flag, I did:

sudo chflags -R nouchg Desktop/

Then again chown is required.

That’s it. Now my data is once more mine.

Chown the data on the time machine

The same problem with permissions exists in the time machine. There fixing them is not so easy – to many symlinks and too many directories owned by root. Also I don’t know whether I should remove uchg from anywhere. So fixing all that is not that simple. If I figure it out – I’ll share the knowledge.