Apr 14

Time Machine, migrating from a network share to an external drive

Category: Uncategorized

why?

I was restoring an entire computer, and restoring from my network share on a NAS wouldn’t work: it would quietly hang, a day in. Copying the backups to an external drive and restoring from that worked.

This is the simpler migration. I’m planning to post the opposite direction separately.

scary warnings (haha, but seriously)

I started writing these for the “external drive to network share” migration, but, uh. Look, doing this still feels a bit cavalier to me, I guess.

These processes were largely worked out with HFS+ backups; I haven’t walked through these with APFS backups.

These (mostly) worked for me, but they are very much not officially supported.

There’s a lot of context, and I’ve likely forgotten details; it’s been a year or two. This is still kind of a rough draft. I’ll try to highlight rough bits and gaps.

Newer versions of the OS might be more protective of letting you access these backups, even as root.

caveats

I think the external drive won’t be encrypted, even if the sparse bundle on the network share was. I think I managed to get it to start incrementally encrypting the external drive by adding it as a backup location, with encryption, then having it go “oh! ok! got it”.

background

On a network share, Macs use sparse bundles to make something that looks like a Mac disk image, on a network share where the file system is relatively unimportant. If the Mac can read and write the files within, things like user IDs, permissions, and encryption don’t have to be coordinated across machines.

mounting the source sparse bundle

On the network share, it will be called something like Bob's MacBook.backupbundle or .sparsebundle. From the Finder, you can “Connect to the server”, go to the network share, select the appropriate sparse bundle, and either double-click it or right-click and “Open” it. You’ll probably see “Time Machine Backups” as a mounted volume.

file layout for “Time Machine Backups”

Note, this is for an APFS backup.

  • Backups.backupdb
    • the name of the Mac, e.g. Bob's MacBook
      • a series of directories with timestamps, like 2024-04-13-092828

preparing the target external drive

Erase and reformat the external drive. Label it something distinctive, so you don’t confuse source and target for the copy. Mount it.

copy data

I’d recommend ethernet instead of wifi.

From a Mac, once the sparse bundle and the external drive are mounted:

# change these as appropriate
input="/Volumes/Time Machine Backups" # sparse bundle
output="/Volumes/Time Machine 2023" # external drive

date; time sudo asr \
  --source "$input" \
  --target "$output" \
  --erase; \
  date

It will prompt for:

  • the sudo password
  • confirmation of the erasure of the external drive

Part of the process was unmounting the source. If interrupted, I had to redo:

  • remount the source
  • erase and reformat the external drive

example output

Validating target...done
Validating source...done
Erase contents of /dev/disk5 ()? [ny]: y
Validating sizes...done
Restoring  ....10....20....30....40....50....60....70....80....90....100
Verifying  ....10....20....30....40....50....60....70....80....90....100
Restored target device is /dev/disk5.

This took about 35 hours to process a 4TB drive, 2.6TB used.

No comments

No Comments

Leave a comment