I use a 2018 MacBook Pro for work and if there’s one thing that I know all too well from working in enterprise environments over the years, is that backups are crucially important. At home, I run a QNAP NAS for, well, generic NAS duties. It’s the workhorse in my house, offering a backup destination and iSCSI volume for my VMware homelab, it runs my Plex server and manages all of my home media. I use this NAS as a Time Machine destination and for the majority of the time owning the NAS I’ve never had an issue with backups. That’s over 4 years from memory.
Over the past few months though I’ve been getting an annoying error some time after the initial Time Machine backup completes. Sometimes it’s after a few days and others it’s after a few weeks. Come to think of it, it’s only been since Catalina was released.
The above screenshot is when I’ve configured the QNAP as a Time Machine target using the NAS’s in built software. My initial hunch was that it was something to do with the recent macOS updates so I started to investigate some more. If I plug in a USB drive directly to the Mac and use that as a backup target I get no issues at all. So I figured that it must be something to do on the NAS or the protocols being used to remote mount and write to the sparsebundle.
Originally when I wrote a draft of this post I had spent a lot of time doing manual fsck checks on the backup, which didn’t really help all that much. Eventually the backups would fail again, so I figured the problem must be elsewhere. So I dug in a little deeper and started scouring the internet for information about Time Machine. I discovered that Apple are moving over to SMB and doing away with AFP some time in the future. On my NAS I checked the various settings and found AFP was still being advertised. For reference, I’m running a TVS-671 running firmware 18.104.22.1680. I went to Control Panel > Service Discovery > Bonjour and then unchecked AFP over TCP/IP. I also did some further reading and it looks like macOS has supported SMB version 3 for some time. What I found interesting is that if you enable the Time Machine Service on the QNAP (under Hybrid Backup Sync 3 > Services > Time Machine) it will set the highest SMB setting to 2.1 – odd. I went into the SMB setting and changed the lowest 3 since all devices at home which connect to the NAS will support 3, as should most modern devices.
Time Machine is pretty slow, especially doing the initial backup. By its inherent design, it is a low priority IO process that doesn’t interfere with user tasks on the computer. Once the initial backup has completed, the remaining delta’s don’t take as long. However I wanted the initial backup to be much faster, so after a bit of Google Fu I found this command:
sudo sysctl debug.lowpri\_throttle_enabled=0
Enter that into terminal and enter your password when prompted. I would suggest setting it back to enabled when on battery power or after the initial backup has completed as the backup process can be quite resource intensive. To do so simply enter:
sudo sysctl debug.lowpri\_throttle_enabled=1
I discovered something else. In my house I have a small desk downstairs where my MacBook Pro is docked. I have an external monitor and also 1 Gbps ethernet available. I have a similar setup upstairs in my office and I often move between the two locations. Even though on the Mac I have the network service order set to prioritise the wired connection, it was still using wifi when docked. I think this is because my work VPN is connected still when I’m moving the mac between locations. As I require the wifi to unlock with my Apple Watch, I can’t just disable it permanently. Now I disable wifi before moving the Mac and let it connect to the wired network before enabling wifi again. This seems to have helped significantly and my Mac now seems to be backing up to my NAS without issue. I’ll monitor the situation and update this post if required.
For more information on Time Machine and some excellent logging tools, check out the Time Machine Mechanic and The Eclectic Light Company site in general which have greatly increased my understanding of the inner workings of Time Machine.