Matter, Energy, and Life of Michaela A. Castello.

TrueNAS: Time Machine


Ten months ago, I thought, “hey, I have a NAS, I should use that to back up our Mac laptops via Time Machine!” Naturally, I ran into multiple past and future bugs and now appear to have arrived at a working solution.

Back in ye olde 2020, I encountered an issue where the entire NIC would crash while Time Machine on the connected laptop was preparing the backup. This made it so I couldn’t access the server via SSH—due to running it headless, I would have to do a full reboot. Searching revealed that this was an issue that would often occur if people were using a RealTek NIC with FreeBSD drivers. When I reviewed the boot log, sure enough:

dmesg
RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet

I was able to fix this by getting an industrial-strength Intel NIC to use instead of the RealTek hardware embedded in the motherboard. There was also a second issue with the samba protocol itself, where vfs_fruit wasn’t able to accept a blank folder for initial backup while also having a size limit restriction, that had been patched but had not yet made it to FreeNAS. Since then, that bug was resolved, FreeNAS became TrueNAS, MacOS updated versions, COVID got worse, and so on.

Initial Setup

Making everything work involves having a dataset configured for Time Machine to use, a share that can be accessed over the network, and a user account that can access everything. I started by making an account on TrueNAS that matched the username and password of the MacOS laptop. I gave those users a home directory and made their primary group timemachine.

Creating the dataset and corresponding share is fairly straightforward as explained in this guide. Note that the share type is SMB, not AFP, which Apple has depricated. When setting up the share, remember to select “Multi-user Time Machine.”

Implementation

From here, it should be as simple as opening up Time Machine on the Mac, selecting the visible Time Machine share, and logging in with the username and password (which I made identical to the laptop username and password for ease of use). On Rachel’s computer, that was all it took and she was good to go. I did it on my own computer first though and encountered a few issues.

Potential Issues

Whatever dataset is going to be holding the Time Machine backups should have a quota set on it to prevent it from taking up all the space on the NAS. I set it up my quota at that top level; however, when each new computer first connects to the share, a sub-dataset is created. Quotas could be set on that level to make them per-computer. I also confirmed that I could retroactively make changes to the quota and the new “drive size” would make its way to the Time Machine app on the Mac.

Next is making sure the timemachine group has full access to the dataset. Rather than making any edits to the defaults that are automatically generated, I made an additional entry in the ACL options giving that group “full control.”

All of this was super easy and I never had any issues on the TrueNAS side with the user being able to read and write to the appropriate share. I did have an issue with logging in from my laptop side, which seems to have had something to do with residua from the previous April 2020 attempts to get this going. This guide held key answers: ultimately the solution for me was deleting everything related to Time Machine in Keychain Access, then ran:

sudo tmutil setdestination -p smb://username@servername.local/sharename

Using setdestination -p is nice because then you can interactively enter the password instead of hardcoding it as the guide suggests. From here, the key was and old standby: I had to reboot and reconnect to everything, and everything started backing up as expected.


You may also enjoy…


Want more? Keep up with the hottest content.