-
Create Samba share using a combination of the following references:
-
Reviewed the following references for ideas on how to migrate Time Machine backups from external HDD to Time Capsule:
- https://jason-townsend.blogspot.com/2008/08/how-to-transfer-local-time-machine.html
- Note the reference did not provide a step-by-step guide for me because of several differences in my setup. First, my external HDD was formatted in exFAT (due to its size) and thus, did not have Time Machine backups directly on it. Instead, an encrypted sparse bundle with HFS+J filesystem was created on the external HDD and mounted manually each time I wanted to do a backup.
- With Time Machine backing up to a network drive, I could have just moved the sparse bundle from my external drive to the shared volume, and mount it manually as usual to do Time Machine backups. However, major downside to this is that I miss out on the benefit of automatic backups.
- If I started fresh (without migrating my old backups), then Time Machine would, on first backup, create a new sparse bundle on the SMB network share and name it MachineName.sparsebundle. This new sparse bundle contains a HFSX filesystem with a capacity that matches the capacity of the network share, unless global quotas are set up via the
.com.apple.TimeMachine.quota.plist
file.
-
To manually migrate the Time Machine backups to a Samba share:
- Create a blank sparse bundle image at the root of the Samba share used by Time Machine. Name it MACHINE_NAME.sparsebundle in the "Save As" field (this file name is what Time Machine uses when creating a new, blank image).
- Set the size of the new sparse bundle as appropriate (max size of backups, should be greater than the size of the HDD/SSD of the system being backed up).
- Time Machine uses "Mac OS Extended (Case-sensitive, Journaled)" by default when creating a new sparse bundle automatically. Select "Mac OS Extended (Journaled)" if the source backup files are contained in a non-case-sensitive system. Otherwise, when copying the
Backups.backupdb
directory later on will fail withThe volume has the wrong case sensitivity for a backup
. - Name the volume "Time Machine Backups" (in the "Name" field, not "Save As" field).
- Mount the newly created sparse bundle.
- At this point, the "Time Machine Backups" should be mounted without "enableOwnership". Enable it by:
- Run
diskutil list
on the Terminal to find the "IDENTIFIER" for the "Time Machine Backups" volume. - With the found identifier, run
sudo diskutil enableOwnership IDENTIFIER
- Example:
The command would be/dev/disk5 (disk image): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme +1.0 TB disk5 1: EFI EFI 209.7 MB disk5s1 2: Apple_HFS Time Machine Backups 999.7 GB disk5s2
sudo diskutil enableOwnership disk5s2
- Run
- Unmount/eject "Time Machine Backups" and remount it. Verify in "Disk Utility" that the "Time Machine Backups" volume is mounted with "Owners" set to "Enabled".
- Copy
Backups.backupdb
from source volume to the newly created "Time Machine Backups" volume. It should prompt for user password as this requires root. - Unmount volume when copy is completed.
- Some Time Machine metadata files are needed within the
.sparsebundle
directory for Time Machine to recognize it properly. Without it, Time Machine will create a blank, new sparse bundle with " 1" appended to the file name, ignoring the sparse bundle created here. The needed metadata files are:com.apple.TimeMachine.MachineID.plist
andcom.apple.TimeMachine.MachineID.bckup
(the bckup file is just a copy/backup of plist):
All information missing above can be found via the "System Information" application included with macOS, within the default/first information pane titled "Hardware Overview".<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>VerificationDate</key> <date>2019-09-04T07:12:34Z</date> <key>VerificationExtendedSkip</key> <false/> <key>VerificationState</key> <integer>1</integer> <key>com.apple.backupd.HostUUID</key> <string>MAC_HARDWARE_UUID_PER_SYSTEM_INFORMATION</string> <key>com.apple.backupd.ModelID</key> <string>MAC_MODEL_IDENTIFIER_PER_SYSTEM_INFORMATION</string> </dict> </plist>
com.apple.TimeMachine.SnapshotHistory.plist
- Can use the blank template below as-is. Time Machine will popuplate this file when it is switched over to use this sparse image.<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Snapshots</key> <array/> </dict> </plist>
- Open Time Machine Preferences and switch over the Samba share (via "Select Disk" option).
- Note Time Machine will ask you to either "Replace" the backup disk or allows you to "Use Both".
- Upon first backup, it may prompt you with a warning that the backup disk may have been tampered with. This can be ignored if it is certain there was no other tampering with the backup data except for the steps done above.
- If all worked above, then it should find the sparse bundle created above, mount it, populate data in
com.apple.TimeMachine.SnapshotHistory.plist
and continue backup where it last left off on the old backup drive.
- Access to Time Machine logs: https://superuser.com/a/1127145/259387