Local Links External Links Contact Search this site |
How to transfer a Time Machine volume to a larger diskNote: After writing this and publishing it on Mac OS X Hints, readers pointed out that - contrary to my knowledge until then - there are two much simpler and safer methods to accomplish this task:
I will leave my own instructions here as a general guide on how to copy entire partitions from one disk to another. Maybe it'll still be useful to some.
IntroductionIn this article I will describe how I moved my entire Time Machine ("TM" for short) backup from one internal disk to another, larger, one. This technique keeps the backup volume intact so that TM keeps using it without the need to start over by losing all previous backups. In my case, I had the volume on a Mirrored RAID set, and move it to another, larger, Mirrored RAID set - so this works, too. Warning: This is a hack that requires some technical understanding of disks. Due to the nature of the operation you could, if you are not paying attention, erase the contents of valuable data on your disks. I have made an effort to tell you what to do to avoid such mistakes during this procedure, though.
Another Note: After I completed this article, I found that there's another step necessary: The GUID of the partition containing the old TM backup needs to be copied to the new partition's GUID or the TM backup may not work right. Copying the GUID, however, can lead to new problems if one is not careful, as OS X uses the GUID two tell disks apart. Hence, once one copies the GUID, the old one should be changed to a new value, too. To copy a GUID, you need to find the partition's GPT entry, which is usually found in block 2 of the disk (provided it's uses a GUID partion table, or GPT for short). Since GPT entries use a checksum on themselves, you need to update the checksums whenever you make changes to the GPT blocks (starting at block 1, usually ending at block 39). You do this by first opening the Partitions window for the disk (Cmd-Shift-D) and then choosing "Fix GPT checksums" from the Disk menu.
Prerequisites
Transfer the dataFirst, disable Time Machine in its Preferences by turning it off, so that it won't attempt to use the disk while we're playing with it. Connect both the old TM drive and the new one. Format the new one by creating one normal Mac OS Extended partition (journaling on/off does not matter as we'll overwrite that soon anyway). Launch iBored, then go to the File menu and choose Run as Root.... Enter your admin password. iBored will restart and list all your connected drives. In this Disks list, you need to identify the backup drive and the new drive. If you can't identify them by their size, do this: Launch Apple's Disk Utility, and locate your disks there. If you select them in the left list and use Get Info on them, it'll tell you the Disk Identifier such as disk1. Match those with the ones in iBored's Disk list under the Where column. Ignore the "/dev/" prefixes in the disk names iBored uses.
Note down the disk names of your original backup disk and the new disk as source and destination disks. Next you need to unmount the TM volume so that no application (that includes the Time Machine backup process) can access it during the time we're working with it. To do that, launch Apple's Disk Utility, and locate the TM volume there. Select it and press Cmd-Shift-U to unmount it. This should make the disk disappear from your desktop (provided you have enabled to show disks on the Desktop in the Finder Preferences). In iBored, go back to the Disks window and select the destination disk. Press Cmd-Shift-M. This will ask you to enable Enable Writing on the disk. Confirm with OK. After a second or two, the new disk's volume that you prepared for your new TM backup should disappear from the Desktop. Now both the source and the destination drives should be unmounted (i.e. not accessible to applications for opening and saving), with iBored having exclusive write access to the destination disk. In iBored, with the destination disk still selected in the Disks window, view its partitions by pressing Cmd-Shift-D. If you just formatted it with one partition, the partition list should show two entries, one "EFI System Partition" starting at 40, ending at 409639, with 200 MB in size. Therefore, the main partition, the one where you will copy your old TM volume into, starts at 409640. If it's different, write that down now. We need this number for the destination start block later. Still within the Partitions window, select the partition with the TM volume, then click the View button. A "Hex" viewer opens. In the text field at the top left, change the number from 0 to 2 and press the Return key. This will get you to the volume's Main Volume Header block. Switch to the Template tab by enabling the Auto-Template checkbox. This should then reveal the data as a HFS+:VolumeHeader. Scroll to the line saying Go back to the Disks window (press Cmd-L), then select the source disk. View its partitions by pressing Cmd-Shift-D. If you see only one partition listed, then your backup volume is probably on a RAID set (if not, better stop and double check these instructions). If you see more than one partition, select the one that contains the TM volume (it's probably the largest one listed). Click on the View button. With the Hex viewer open, go into the menu to Disk -> Copy Blocks to.... In the upcoming "Choose Devices" window, change Write To: to the destination disk. Press OK in the Choose Devices window to get you to the "Specify Block Range" window for the source. It's already set up to copy all blocks of the partition you had chosen in the previous steps. Click on Dest...'. Another "Specify Block Range" window for the destination appears. Change its Start Block: to the start block number as identified above, normally 409640. Finally, click OK. This will start the copy process. Wait for it to finish. It can take a few hours depending on the disk size. The expected duration is shown in the progress window, as amount of minutes (the number before the speed). Quit "Disk Utility" while the copy operation is still in progress. Once the copy is finished, quit iBored and relaunch "Disk Utility". It should now show your two TM drives, both containing a volume of the same name. Select the volume that belongs to the larger (i.e. new) disk. Mount its volume by pressing Cmd-Shift-M. The disk's icon should appear on the Desktop. Open it in the Finder and verify that it contains your backup. You could even open Time Machine and let it perform a backup to see that it works. Should the volume not appear, something went wrong. Reformat the disk and try it all again. If still no success, feel free to contact me. In any case, no real damage should be done, since you should have only written to the new disk which contained no valuable data yet, while your original should still be intact (you can re-mount that, too, using Disk Utility). Adjust the volume to the larger size.Assuming all went well, it's now time to adjust the volume size of the copy, as it still shows the size of the original, instead that of the new drive's larger size. For this, we modify the Main Volume Header block (the Backup Volume Header should get auto-fixed once we use the Repair feature, see below). Quit "Disk Utility". Launch iBored as Root user again. Then select the source disk and enable writing by pressing Cmd-Shift-M. Then press Cmd-Shift-D. In the upcoming Partition window select the one being the large TM partition and press the View button. In the Hex viewer, change the 0 into 2 and press Return to get to the Main Volume Header again, just like earlier. Again, switch to the Templates tab, which should say "HFS+:VolumeHeader", select the line saying Quit iBored, relaunch Disk Utility, select the new TM drive and use the Repair button in the 'First Aid tab. This will now verify the disk, which can take a few hours again depending on the size of the TM backups on it, and will eventually say that the Volume Bitmap and the free block count need fixing. Everything else should be OK (assuming the original TM volume had no errors, either). Once these values are repaired, the volume should re-appear on the Desktop, now showing the new size and corresponding larger free space. Once all is fine, you may enable Time Machine again. ConclusionIf you've performed all step successfully, you'll agree that it's pretty simple: Copy all blocks of the volume over the new disk's empty volume, then adjust the total block count in the volume header, and have Disk First Aid fix the rest of the related values. This could certainly be turned into a product of its own. If you have the programming skills, I'm happy to supply you with any information you need for this. If you are someone who isn't so good at programming but think this should be turned into a product and have marketing and design skills, please contact me. I'm a coder and could use a capable and enthusiastic partner. I'm happy to share the revenue decently. And if you have tried this and understood what you were doing but found errors in this article or have other constructive criticism, please let me hear it. Finally, since iBored can also access disks over the internet, I or someone else could also help you to figure out if there's something odd going on. You can try contacting me via iChat (or Adium/AIM) at supertempel or via Skype at tempel.org (text chat only, no voice calls!) and then I could have a look at your disks to see what the problem might be. Hope this helps. Thomas Tempelmann |