Mac – Time Machine to Sparsebundle image on Windows 2012 server

backupmojaveterminaltime-machinewindows

So I've got this MB Air (Mojave 14.1 -all updates applied-) at work and thought I would try backing it up using Time Machine to an old PC running Windows Server 2012 (All updates also applied) and I go through the setup procedure:

  1. Create a Sparse Bundle image (tried HFS+ & APFS images)
  2. Copy image to previously set up Windows share with correct permissions and login saved to the macOS keychain
  3. Mount image from the Windows share and verify I can write to it.
  4. Run terminal command to set Time Machine to use the mounted share as a destination:

sudo tmutil setdestination /Volumes/MBAir

And I get an error

The backup destination could not be set

After much Googling where a lot of answers pop up from AskDifferent none of them seem to have this particular issue using macOS Mojave.

Pretty sure I have the correct options for the sparse bundle selected. I tried both HFS+ and APFS format on the sparsebundle. And once it is mounted on the desktop on the Mac I can put files into the sparse bundle, so it is writable.

Wondering if anyone has any experience with this?

===
I tried the suggestion, "sudo tmutil setdestination smb://username@server/share -p instead, and allow tmutil to create it's own sparsebundle on the server." which returned an error. See comment below.

Best Answer

It turns out that when you create a sparse bundle disk image that resides on an APFS volume that it is ALWAYS formatted as APFS even if you specify the the format as HFS+ like this:

Disk Utility Sparse Image HFS+

I created a few of these (just to be sure) and each one failed as a Time machine Destination.

As @user128998 pointed out in his comment Time Machine relies on a feature of HFS+ to do it's job and will not work on one formatted as APFS.

I had assumed that disk utility was creating an HFS+ formatted sparsebundle because I had selected that option when creating the image, as shown in the screencap above.

In frustration I did a Get Info on the mounted sparseimage bundle and it showed as an APFS volume. Grr... So I deleted it and created another one and was very careful to NOT select APFS.

When I mounted that sparseimage it too showed as an APFS volume.

Opening Disk Utility I selected the mounted sparseimage volume and reformatted it as HFS+. The operation took longer than I expected (3 - 4 minutes) but it was successful. And this time when I ran the command

sudo tmutil setdestination /Volumes/MBAir

It worked!

So maybe I found a bug in Mojave (14.2) with disk images and/or sparsebundles. Or maybe it is expected behavior and I didn't know it, either way this can be marked as solved.