Time Machine on a local drive, then make that drive a network drive (via Server.app) on a different computer
Solution 1:
Better later than never, here is a hack to achieve this :
sudo ifconfig lo0 alias 127.0.0.2/32
Plug your usb drive, then via System Preferences
/ Sharing
add a smb share to a folder time-machine-macbook
in the drive time-machine-usb
Then, add a destination backup (Time Machine will see it as a network share)
sudo tmutil setdestination -a "smb://user:[email protected]/time-machine-macbook"
You can see if it's ok with:
tmutil destinationinfo
> ==================================================
Name : time-machine4
Kind : Network
URL : smb://kenji@realserver._smb._tcp.local./time-machine
ID : D820D053-C74A-4A06-A7E1-E60C8EA7934F
====================================================
Name : time-machine-macbook
Kind : Network
URL : smb://[email protected]/time-machine-macbook
Mount Point : /Volumes/time-machine-macbook
ID : F707BD0B-64DF-4DB6-A3B7-824470FB5EB2
Then start a backup with tmutil startbackup
and mount
will show:
/dev/disk3s1 on /Volumes/time-machine-usb (apfs, local, nodev, nosuid, journaled, noowners)
//[email protected]/time-machine-macbook on /Volumes/time-machine-macbook (smbfs, nobrowse)
You can see detailed progress with tmutil status
:
Backup session status:
{
BackupPhase = Copying;
ClientID = "com.apple.backupd";
DateOfStateChange = "2018-06-28 17:38:21 +0000";
DestinationID = "F707BD0B-57DC-4DB6-A3B7-824470FB5EB2";
DestinationMountPoint = "/Volumes/Time Machine Backups";
FirstBackup = 1;
Percent = "0.08711567546702646";
Progress = {
TimeRemaining = 32679;
"_raw_totalBytes" = 355694600192;
bytes = 34429528173;
files = 887351;
totalBytes = 391264060211;
totalFiles = 2922384;
};
Running = 1;
Stopping = 0;
"_raw_Percent" = "0.09679519496336274";
}
In my case, near 1000000 files were done in about two hours (USB2 disk penalty, versus more than 8 hours via Wi-Fi), I calculate percentages with a small script:
tm-progress.sh
Files : 918702 / 2922384 (31.43%) - Bytes : 32.21 GiB / 364.39 GiB (8.84%)
We can here that many files can make Time Machine to progress "slowly" in Bytes, but nearly 1/3 of files have been copied.
Next step, when backup is finished, plug the usb drive to your realserver and copy the sparsebundle over the "uncompleted one" (or in the shared folder). Of course, Time Machine should be disabled during this step to prevent mounting a partially copied sparsebundle (and maybe corrupting it)
I have used an apfs drive to benefit of snapshots (to be able to revert to a previous "backupdb" in case of sparsebundle corruption, not tested yet)
Edit: even faster mode :
Once the backup has reached BackupPhase = Copying
to make it faster you can make the backupbundle mount directly (without sending every operation through smb) by canceling the backup, renaming My-Computer.backupbundle
to something like 1My-Computer.backupbundle
, and creating a symbolic link :
ln -s /Volumes/time-machine-usb/1My-Computer.backupbundle /Volumes/time-machine-macbook/My-Computer.backupbundle
This tricks timemachine into following the link to the backupbundle localy, and not mount it through smb, which speeds up the backup. Make sure you move the backupbundle back when you have finished your local backup.
Solution 2:
See my other answer first which is a lot simpler!!
This is Kenji's answer ("ıɾuǝʞ" above), reworked painfully and explained by a complete noob (myself) for other complete noobs. I also added an important workaround in the last step:
Better later than never, here is a hack to achieve this:
-
Open Terminal.app and enter the following command:
sudo ifconfig lo0 alias 127.0.0.2/32
Plug in your usb drive
- Go to
System Preferences
/Sharing
-
Open the lock in the bottom-left corner
(Whenever asked for your password, go ahead and enter it)
Tick "File Sharing" on the left pane.
- Tick
Options
button and activate both SMB and AFP - Click the
+
sign in the middle pane (titled "Shared Folders") and locate your USB drive. Create a folder (e.g. "time-machine-macbook") and select it to create the shared folder. -
Then, add a destination backup (Time Machine will see it as a network share), using the following command in Terminal.app:
sudo tmutil setdestination -a "smb://user:[email protected]/time-machine-macbook"
(If you get an error that Terminal needs more access rights to your disk, then go ahead and follow the instructions of the error message to give such rights and repeat this step.)
You can check if it's ok with the following Terminal command:
tmutil destinationinfo
And you will get the following reply on your Terminal window:
================================================== Name : time-machine4 Kind : Network URL : smb://kenji@realserver._smb._tcp.local./time-machine ID : D820D053-C74A-4A06-A7E1-E60C8EA7934F ==================================================== Name : time-machine-macbook Kind : Network URL : smb://[email protected]/time-machine-macbook Mount Point : /Volumes/time-machine-macbook ID : F707BD0B-64DF-4DB6-A3B7-824470FB5EB2
-
Then start a backup with Terminal command:
tmutil startbackup
-
Terminal command
mount
will show (among others) something like:/dev/disk3s1 on /Volumes/time-machine-usb (apfs, local, nodev, nosuid, journaled, noowners) //[email protected]/time-machine-macbook on /Volumes/time-machine-macbook (smbfs, nobrowse)`
-
You can see detailed progress with Terminal command:
tmutil status
Where you'll get something like:
Backup session status: { BackupPhase = Copying; ClientID = "com.apple.backupd"; DateOfStateChange = "2018-06-28 17:38:21 +0000"; DestinationID = "F707BD0B-57DC-4DB6-A3B7-824470FB5EB2"; DestinationMountPoint = "/Volumes/Time Machine Backups"; FirstBackup = 1; Percent = "0.08711567546702646"; Progress = { TimeRemaining = 32679; "_raw_totalBytes" = 355694600192; bytes = 34429528173; files = 887351; totalBytes = 391264060211; totalFiles = 2922384; }; Running = 1; Stopping = 0; "_raw_Percent" = "0.09679519496336274"; }
Of course you can also have a rough idea of the progress by opening Time Machine where you will get the total MB copied as well as a calculation of the time remaining.
In Kenji's case, near 1000000 files were done in about two hours (USB2 disk), versus more than 8 hours necessary via Wi-Fi. My results were quite faster with a USB3 disk. In 2h I had backed-up more than 500MB.
Next step, when backup is finished, plug the usb drive to your realserver and copy the sparsebundle over the "uncompleted one" (or in the shared folder). Of course, Time Machine should be disabled during this step to prevent mounting a partially copied sparsebundle (and maybe corrupting it). I have used an apfs drive to benefit of snapshots (to be able to revert to a previous "backupdb" in case of sparsebundle corruption, not tested yet)
If #12 above doesn't work and Time Machine cannot backup TO the really-networked drive (but may possibly be able to read it), then the workaround is to copy the backup bundle inside a new sparsebundle! Awkwardly, Time Machine can use networked sparsebundles as backup destinations (but not it's own backupbundle!).
Have your drive connected via USB (for speed) and use Disk Utility to create inside it a sparsebundle with the necessary size to fit all your backup. This might take a few hours depending on the size and speed, so choose to do it overnight. If you don't have enough drive space, then unfortunately you should remove your previously created backup and re-create it later on from the beginning inside the new sparsebundle.
To create the new spasebundle, open Disk Utility, click File/New Image/Blank Image and in the pop-up window add a filename (e.g. BackupBundle.dmg), no tags, choose to be inside your USB drive root, choose a volume name (e.g. BackupBundle), size larger than your HD size, format definitely Mac OS Extended (Journaled), no encryption, Single partition - Apple Partition Map, and finally sparse bundle disk image. Check again your selected size (sometimes it gets back to default) and hit save.
-
Hours later, when it's over, you may test your new sparsebundle over the network. Connect your drive to your router, open Finder, and double click your BackupBundle.sparsebundle. You should see a new disk on the sidebar and on your desktop called BackupBundle. Then open Terminal and see if the sparsebundle can be added as a backup destination. If not, then you can set it manually via Terminal.app:
sudo tmutil setdestination -a "/Volumes/BackupBundle"
After all this, you can copy Time Machine's backupbundle inside your BackupBundle.sparsebundle. This will also take hours, so you may want to do it the next night. Alternatively, if you didn't have room in steps 14-15 and you had to delete it, you can set Time Machine to use it as backup destination when connected via USB and then again after the first full backup is completed to select the same destination via network.
Good luck!
Solution 3:
The tricky thing about moving a Time Machine backup from a local hard drive to a remote server (or vice-versa) is that Time Machine uses a native HFS+ partition directly for local backups, but when backing up to a server over AFP, it creates a "sparsebundle" disk image.
You can use Disk Utility to make a sparsebundle image of an HFS+ partition, and then put that image in one of the server's shared volumes, but I'm not sure if there's anything else you'd need to do to the sparsebundle to make Time Machine recognize it and use it automatically. For example, you might have to name it exactly right, and there might be some kind of hidden files it looks for inside the sparsebundle or something.