Time Machine on a local drive, then make that drive a network drive (via Server.app) on a different computer

2

1

I have two macs running OS X 10.10.3. One has Server.app installed, is connected to the internet via ethernet, and also has a 2 TB disk attached via USB, with two partitions - "Backup" and "Storage". My other mac is a laptop used for schoolwork.

Using the Time Machine feature of Server.app, I was able to use the standard Time Machine interface to begin backing up my local mac onto the "Backup" volume on the server mac over the network.

However, I discovered that it takes 7 minutes to copy a 1 GB file over AFP, so backing up 300 GB on my local mac would take at least 35 hours.

So, I'm trying to figure out a way in which I could do the initial 300GB backup onto "Backup" over USB, and then connect that external hard drive to the server mac and continue doing backups over the network. That way, the incremental network backups would be much smaller than 300GB and could be done in a reasonable time period, e.g. overnight.

Any suggestions? I read the man page for tmutil but I'm not very comfortable with it just yet.

mchen.ja

Posted 2015-04-22T17:32:42.337

Reputation: 312

Please don't cross-post to multiple SE sites – Tetsujin – 2015-04-22T17:37:11.427

Just curious, is your laptop on Wi-Fi? What's your AP? What's your PHY rate? 7 minutes per GibiByte is like 20 megabits/sec, which would be great for 802.11g in 2003, but pretty terrible for 802.11n or 802.11ac, unless you're on a channel full of interference or a long way from the AP. – Spiff – 2015-04-22T18:48:10.127

yeah, my laptop is on Wi-Fi. I'm not sure what AP or PHY rate is. I'm in a house with 50 people who all have their own laptops, phones, etc., so there probably is quite a lot of interference. – mchen.ja – 2015-04-22T21:09:22.857

Answers

3

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:password@127.0.0.2/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://user@127.0.0.2/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)
//user@127.0.0.2/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)

ıɾuǝʞ

Posted 2015-04-22T17:32:42.337

Reputation: 181

Amazing trick, thank you! Already experimented with such kind of hacks but never guessed to mount local drive as network drive. Probably, in this case there will be an overhead charge for passing local traffic through the TCP/IP stack, but compatibility is achieved, which is more important. – mkll – 2018-09-11T15:47:52.507

My main goal is to ensure the portability of my backup drive so that it can be mounted on an AFP network server, and locally via USB. Also I want to be able to copy sparsebundle from one physical drive to another. Your trick allows me to achieve all this. Cool! – mkll – 2018-09-11T15:56:40.647

just had to do this again today, with a 880Gbyte sparsebundle... – ıɾuǝʞ – 2018-09-12T16:25:33.163

1This worked for me but the first command should be sudo ifconfig lo0 alias 127.0.0.2/32. Thanks! – Ernesto Allely – 2020-02-25T11:10:47.473

edited to fix ifconfig command, thank you @ErnestoAllely – ıɾuǝʞ – 2020-02-26T12:33:02.157

2

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.

Spiff

Posted 2015-04-22T17:32:42.337

Reputation: 84 656