Time Machine with Windows Server? --Setup An Ubuntu Server with Hyper-V
There are tons of network backup solutions available for Windows and Linux. However, as Apple likes to make their own wheel so much, Time Machine is officially supported only by Apple’s own hardware and a few commercial NAS providers.
In order to make Time Machine work with Windows Server, one can follow this guide to create a sparse bundle image and share it over the network. However, it is quite unreliable as most of the time, macOS cannot recognize and mount this drive appropriately upon start-up or wake-up. A more elegant solution has been provided on Linux with the help of the
netatalk package. Here I will describe all the steps needed to create an Ubuntu Server with Hyper-V hosted on your Windows Server and use a virtual disk (VHDX) file dedicated as a Time Machine backup location.
First, install Ubuntu Server into Hyper-V. With modern Ubuntu releases, Gen 2 VM is absolutely going to work and is recommended. As this server is dedicated only to make Time Machine work, we can assign a small hard drive space (20 GB) and RAM size (1 GB). Dynamic RAM will be a very useful function to use here. After all the configurations, the assigned RAM is typically ~800 MB.
Create and config a dedicated virtual disk space
Then, we create a virtual disk (VHDX) as a dedicated backup space for Time Machine. You can use either the Hyper-V Manager or Disk Management to do so.
In Hyper-V Manager, go to the Settings of the Ubuntu VM, add a hard drive under the SCSI Controller, and point it to the virtual disk that you just created.
Now start your Ubuntu VM and connect to it with your favorite tool, e.g.,
We will prepare the connected virtual disk for use.
First, check the device name of the virtual disk:
sudo fdisk -l
The virtual disk is usually ‘/dev/sdb’:
Disk /dev/sdb: 250 GiB, 268435456000 bytes, 524288000 sectors Disk model: Virtual Disk Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0xed899760
Then, use the graphic
cfdisk tool to create a partition that covers the entire drive:
sudo cfdisk /dev/sdb
In this tool, create a new partition (which should be
\dev\sdb1 that covers all the space in this drive, Write the results, and Quit the tool.
Format this partition with ext4, and assign a volume label (optional) at your convenience:
sudo mkfs.ext4 /dev/sdb1 sudo e2label /dev/sdb1 timemachine sudo reboot now
After the reboot (required), we need to tell the server to mount this volume automatically and give access. We first create a folder for the time machine storage. This can be anything but here i will use
sudo mkdir /media/timemachine
Now we will look for the UUID of the volume we created (virtual disk):
Look for the UUID of the volume that was created (in this case,
dev/sdb1 with a volume label
timemachine. Copy it and then edit this file:
sudo nano /etc/fstab
Of course, I prefer
nano which is much more user-friendly than
Append the following line to this file:
UUID=XXXXX /media/timemachine ext4 defaults 0 0
where the XXXXX is the UUID you just copied. Ctrl+O to save this file, and Ctrl+X to exit.
Now we can reboot the server again and check if it’s automatically mounted. Otherwise, we can mount it now:
sudo mount /dev/sdb1 /media/timemachine
sudo chown -R USER /media/timemachine
Here, USER is the username in your Ubuntu Server that will be used for backup. You will need this account to log in when you point your Time Machine destination in macOS.
Install and config netatalk
Next, we install the following packages:
sudo apt install netatalk avahi-daemon
avahi-daemon is a Bonjour service used for network location discovery on your mac.
Edit the config file of
sudo nano /etc/netatalk/afp.conf
nano, add the following content:
[Time Machine] path = /media/timemachine time machine = yes
Ctrl+O to save this file, and Ctrl+X to exit.
Restart the netatalk service:
sudo service netatalk restart
Now you should be able to see and select this drive for Time Machine in macOS if it is in the same local network as the server. The login info is the account you use on your Ubuntu Server, not what you use on the mac.