Mac – Time Machine – move backup from local disk to network volume. Wrong case sensitivity

dmgmigrationsparsebundletime-capsuletime-machine

I am trying to move a Time Machine backup from a Firewire disk (called disk1) directly connected to a computer to a network share, that is, from a folder in/on /Disk1/Backup.backupdb to a sparsebundle/disk image (called dmg1) stored in the network share.

Following some suggestions in a Time Machine FAQ I begun a new TM backup to let Time Machine create the needed disk image. As soon as the image was created I cancelled the backup.

Next step was to mount this new image (the resulting volume is called Time Machine Backup, TMB for short) and delete the /TMB/Backups.backupdb directory. Finally I was supposed to copy /disk1/Backups.backupdb to /TMB/. Unfortunately, this last step fails with an error message The volume has the wrong case sensitivity for a backup.

Apparently disk1 is not case sensitive (which was/is the default) but for some reason Time Machine sparsebundles are created case sensitive = you can't copy an old local backup (Or can you? Finder prevents it but "logically" it shouldn't be a problem to copy files from a case insensitive volume to a case sensitive volume. The other way around should, however, not work.) to the disk image that is necessary to use if you want to backup to a network volume.

This must be a pretty common usecase, especially since Apple themselves sell a simple NAS (Time Capsule) for this specific purpose, so how is such a migration supposed to be done? The only/most common advice I found when I google for solutions is to start over, but then you waste quite a bit of space as well as lose readily accessible backup history. Not good.

Best Answer

I ran into the same issues when following advice similar to the OP, specifically, to use Time Machine to start the backup to create a new sparse bundle on the network share, stop the back and copy Backups.backupdb to the newly created sparse bundle.

My solution is to mimic what Time Machine does to create the new sparse bundle with only one difference: format with "Mac OS Extended (Journaled)", which is not case sensitive. The major benefit to this solution, in addition to preserving old backups, is that this maintains all of Time Machine's expectations of a network share backup disk, and thus, hourly auto backups, etc. will work seamlessly without other scripts or workarounds.

I've kept details and notes for myself in the "Migration from External HDD to Samba" section at: https://gist.github.com/martian111/e0d9885004eb56fd6abf3d1ba7671737, but the TL;DR steps relevant to solving this question are (starting at where the OP left off when he/she encountered the error):

  1. If necessary, stop Time Machine backup and disable until migration is complete.
  2. Create a new sparse bundle using "Mac OS Extended (Journaled)" as the format and the same naming conventions as the unusable, case-sensitive sparse bundle created by Time Machine.
  3. Use distutil to enableOwnership on the "Time Machine Backups" volume (after mounting the created sparse bundle). (Ref: https://apple.stackexchange.com/a/53243/174505)
  4. In the Finder, move/copy the Backups.backupdb directory to the new volume after confirming ownership is enabled. The Finder should prompt for admin privileges.
  5. Unmount "Time Machine Backups" volume
  6. Copy com.apple.TimeMachine.* metadata files from the sparsebundle directory created by Time Machine into the sparsebundle created above.
  7. Delete the unusable, Time Machine created sparsebundle, and replace it with the one created here (changing the sparsebundle directory name).
  8. Re-enable Time Machine's "Back Up Automatically".

Once the above is done, the next Time Machine backup should recognize the sparse bundle created and continue where the last backup left off. Also, all historical backups are browsable when entering Time Machine.

Note: My Mac's root volume is also not case-sensitive, so I assume this is safe for my setup.

Note 2: My Time Machine network share is a Samba/SMB share running in Linux. The disks hosting the SMB share are encrypted with LUKS, and thus, I do not use Time Machine's encrypted backup feature.