?

Log in

No account? Create an account
 
 
03 February 2008 @ 12:28 am
Time Machine  
Apple's "Time Machine" backup solution is simple. A bit too simple. So simple, in fact, that it doesn't actually work right in a pretty common situation unless you're a clever hacker. So much for being easy for dummies.

Let's say, for example, that you have gotten your computer repaired, and thus have a new motherboard. The next time you try to back up your machine with Time Machine, you'll find that it wants to do a whole new "full" backup, which of course doesn't fit, due to the existing full backup already on the drive.

So, how do you make Time Machine do an incremental backup of the same hard drive you had before, now that it's in a new computer?

After a bit of fiddling around, I figured out that it stores the ethernet address of the machine you backed up, and that's how it figures out which backup directory to use. Where does it store it? A extended attribute of course.

$ cd /Volumes/james\ backup/ 
$ xattr -l Backups.backupdb/James\ Knight’s\ Computer/
com.apple.backupd.BackupMachineAddress: 00:1b:63:1e:77:4c


Looking at ifconfig en0 | grep ether shows that it should be 00:17:f2:f1:42:ad. So, let's just set the attribute...

$ sudo xattr -w com.apple.backupd.BackupMachineAddress \
 00:17:f2:f1:42:ad Backups.backupdb/James\ Knight’s\ Computer/
[Errno 1] Operation not permitted: 'Backups.backupdb/James Knight\xe2\x80\x99s Computer/'


Hmmmm, interesting, can't modify, even as root. I'll save you the random flailing I did next, and get right to what works (and I really have no idea what kind of insane-o permissions scheme does make the following work...)

$ sudo mv Backups.backupdb Backups.backupdb2
$ sudo xattr -w com.apple.backupd.BackupMachineAddress \
 00:17:f2:f1:42:ad Backups.backupdb2/James\ Knight’s\ Computer/
$ sudo mv Backups.backupdb2 Backups.backupdb


All done! Just unmount and remount the backup drive, and time machine will properly recognize it again. Now if only Apple had thought to key backups off of some identifier on the actual volume being backed up, instead of the machine doing the backing-up. Doesn't seem like rocket science, does it?
 
 
 
300baud300baud on February 4th, 2008 06:58 pm (UTC)
$ sudo mv Backups.backupdb Backups.backupdb2
$ sudo xattr -w com.apple.backupd.BackupMachineAddress \
00:17:f2:f1:42:ad Backups.backupdb2/James\ Knight’s\ Computer/
$ sudo mv Backups.backupdb2 Backups.backupdb


That could grace the front page of The Daily WTF.
(Anonymous) on October 16th, 2008 04:21 pm (UTC)
TimeMachine and other backups
I use SuperDuper to make a bootable copy of my main drive. When my main drive died and I booted off the copy (which I had renamed to match the dead one), TimeMachine made a new copy of it. The computer and its MAC number had not changed, of course. So, TimeMachine is also keeping track of individual disk drives, and I don't know how to tell it to treat an identical copy as the original drive. But perhaps I can use your post as a guide to find out.
(Anonymous) on February 13th, 2009 11:42 am (UTC)
Re: TimeMachine and other backups
Within each backup there is one directory for each volume to be backed up. This directory also has xattr keys:

com.apple.backupd.SnapshotVolumeUUID

This is probably what needs to be updated to adopt a new drive.

com.apple.backupd.SnapshotVolumeFSEventStoreUUID

This is probably how Time Machine checks whether it can make a quick backup (using the FSEvent store for a list of changed files) or it has to re-check all the files.
(Anonymous) on February 13th, 2009 02:44 pm (UTC)
How to "adopt" a copied partition to an existing TimeMachine backup stream:
I just tested it, and it does at least seem to work as desired.

DISCLAIMERS: Do this at your own risk! And have a backup of at least your most important files on a separate medium! Do not attempt this if you are uncertain about any of the consequences or circumstances here! NO GUARANTEES WHATSOEVER!

Below I describe the steps needed to re-connect Time Machine after migrating a partition from one harddisk to another one. I know it works with an image copy of your partition:

Start from a different disk if you want to copy the system partition (use the system DVD if necessary). In Disk Utility select the target disk (which must have been partitioned so your Mac can actually boot from it!), click Restore, drag the target partition to the Target field, the old partition to the Source field. Don't forget to select Erase destination or it will in fact just make a file copy. Progress will then be shown as copying blocks instead of copying files.

The copy will be almost identical to the original. Only the drive ID (UUID) will be different, and that is why Time Machine would try to make a complete backup if we didn't do something against it.

I have not tested whether a mere file copy of a partition can be re-connected successfully so that only incremental backups are made. It does seem to work with an image copy, though.

Important: First, disable Time Machine.

Open Disk Utility, select your new partition and press CMD-I to display the partition's information. You will need the Universal Unique Identifier value down below.

Open Terminal, then go to the last Time Machine snapshot:
cd /MY\ BACKUP\ DRIVE/Backups.backupdb/MY\ MAC/Latest

(Replace the green text as needed for your machine; Spaces need a backslash prefix as shown.)

For safe keeping, display the old partition's ID Time Machine had known before:
 sudo xattr -p com.apple.backupd.SnapshotVolumeUUID MY\ SYSTEM\ PARTITION

It will print out a UUID just like the one displayed in Disk Utility above. If the two are identical, Time Machine will make an incremental backup; If they don't match, it will back up the entire partition again.

So if you are really, really certain that your new partition is in fact just a copy of your original partition and you want Time Machine continuity, you can re-connect the last backup of your old partition to your new partition by overwriting exactly that UUID with the one of the new partition.

Now temporarily disable ACL protection for the backup drive:
sudo fsaclctl -p /Volumes/MY\ BACKUP\ DRIVE -d

Whatever you do, do not forget the matching command below to re-enable it again!

This is the critical step: Overwrite the UUID with the UUID you have copied from Disk Utility above:
sudo xattr -w com.apple.backupd.SnapshotVolumeUUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
MY\ BACKUP\ DRIVE


Now re-enable ACL protection for the backup drive:
sudo fsaclctl -p /Volumes/MY\ BACKUP\ DRIVE -e


Now you can re-enable Time Machine and it should recognize your new partition as the same as your old one and only make an incremental backup.

When even the motherboard of your Mac has changed, proceed as described in the respective hint.
(Anonymous) on February 14th, 2009 09:13 am (UTC)
Correction: How to "adopt" a copied partition to an existing TimeMachine backup stream:
Correction:

I had confused the names above. The setting of the new UUID must of course be like this:
sudo xattr -w com.apple.backupd.SnapshotVolumeUUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx MY\ SYSTEM\ PARTITION
(Anonymous) on July 22nd, 2009 05:40 pm (UTC)
Re: Correction: How to "adopt" a copied partition to an existing TimeMachine backup stream:
Right, that's what I did without even realizing it.

By the way, your instructions worked perfectly... If you read this, thanks a bunch!

~Randy
ext_143952 on January 18th, 2009 11:01 am (UTC)
Thx
Thx a lot for your mini-tutorial! It perfectly did the trick for me. Me too I had my logic board replaced, and I kind of like my backups, although I rarely used them. (A geek illness, I suppose.)

I don't think it's really a bad idea to link the backups to the ethernet address. And for me the worst failure is not even because of the replaced logic boards, but its when a standard user restores his account from a time-machine volume to his newly bought mac. I think it would have been very easy to ask the user if he liked to continue to use this backup volume for his new computer, and then change the xattr to the new ethernet address. (I'm pretty sure apple knows a more elegant way to change the xattr than renaming the folder temporarily.)

Moreover, the noob workaround in the case of the logic board would be: Fresh install of OS X, restore from backup, and accept the "continue with old backup" dialog.

I guess I gotta post in Apple's support forums about that. Thanks for your research in the mean time!
(Anonymous) on March 13th, 2009 04:38 am (UTC)
Yes, but....
My office has a wired network. At home I have a wireless network. So I use two different MAC addresses on a daily basis. My Time Machine drive is a USB I carry around with me. *sigh*
goldnet on March 3rd, 2010 01:03 am (UTC)
'Lost' Time Machine Backups
Fascinating. I suffered loss of all my backups and I have not changed my hardware - but a Time Capsule reset perhaps has thrown the IDs. The TC is almost full so insufficient space for a full backup. I can mount and see all the backups but they're not accessible to Time Machine. Tried Option-Start and right-click to select other volume but Time Machine still only seems to mount whichever is the empty sparsebundle. How can I identify the right one and access it?
(Anonymous) on September 14th, 2010 07:37 pm (UTC)
PPC G5 10.5.8 to Mac Mini 10.6.4 TimeMachine
Curious to know if this solution would work for my situation...
Time Machine was set up on a PPC G5 running Leopard(10.5.8)
Recently purchased a Mac Mini (Snow Leopard 10.6.4) and had manually transferred desired files from PPC G5 to Mac Mini over LAN. Customized Mini as desired (preferences, apps, etc.) Had removed Time Machine HDD from PPC G5 placed into external enclosure and connected via USB to Mac Mini.

PPC G5 has then since been completely wiped with a fresh install of Leopard.

Is there any way the Mac Mini can take ownership of previous system Time Machine backups and continue with incremental back ups?

Was not aware that Snow Leopard had the Migrate feature with Time Machine - that's why it was not done.

Any help, guidance, direction, magic spells, would be greatly appreciated!

Thanks in advance.