Is anyone out there using a ZFS dataset as a Time Machine backup target over SMB (See note below)? I’m going to set that up this week, and I’d like to set up snapshots with it. I’m not sure what snapshot schedule would be most efficient–Time Machine itself runs every hour, and I’m not really sure what happens if ZFS takes a snapshot while TimeMachine is writing to the NAS.
It seems like the same problem as accidentally taking a backup of a database in the middle of an incomplete transaction, with a tool that isn’t smart enough to know to only back up the committed transactions.
So:
- Am I overthinking the interaction between ZFS snapshots and Time Machine? The tutorials I’ve watched don’t seem concerned, but I don’t understand why.
- What snapshot schedule would y’all recommend that would be effective without being overkill?
The target pool on the server is a massive HDD pool, if that matters. Plenty of room, but not likely to ever hit write speeds over 600 MB/s, not counting all of TimeMachine’s file comparison overhead and SMB’s overhead from its chronic hatred of having anything to do with small files.
Why SMB this time?
(To be read in the voice of Troy McClure )
- You might remember when I was going to do this with iSCSI. I even rambled about it a bit. Real life intervened in general, and I also realized that the state of iSCSI initiators on Mac OS is just pathetically sad. So that … did not happen.
- There’s apparently one (1) < $30 option that can’t transfer over 100 MB/s, and ATTO’s initiator product, which costs $200+ for a seat to buy an initiator, like it’s 1998 and you need to get your Mac to talk to a Netware printer. I’d still like to get iSCSI working from my Mac someday, but Time Machine is made for SMB, so at least I’m trying to make it do something it was made to do.
Its more like taking a snapshot of a database with a tool that IS transaction aware. To do the right thing with transactions ZFS just need to correctly follow the fsync command.
Assuming Time Machine uses fsync correctly then it will be fine to take a ZFS snapshot while running a TM backup. You will 3nd up with an incomplete backup for the latest TM backup, but the previous one should be healthy and usable.
Given that TM is pretty smart about its backups, I would probably do 7 nightly snaps at midnight, then maybe 4 weekly snaps at midnight also. The ZFS snaps are mainly for the “whoops I corrupted my TM backup by accident” scenario.
TrueNAS actually implemented a sort of protection mechanism into their version of samba that will take a snapshot of the time machine dataset after a time machine client disconnects - the idea being that once the client is disconnected it should be left as a usable restore point. An ix employee (the apparent author) comments in a forum post that they never documented it very well, but their work could probably be up-streamed.
That work hasn’t been up-streamed, to my knowledge, and I never found a comparable feature set elsewhere.
1 Like
That covers exactly the situation I was concerned about.
I’m curious if it’s still in SCALE, actually.
They mention an “Enhanced” Time Machine preset. I’ve only seen the “Basic” one. They also mention SMB aux parameters, which as far as I know have been removed from the user-facing part of TrueNAS SCALE since at least the version before Dragonfish.
So, you’d need to check the TrueNAS CLI to see if they’re still enabled. I’ve never done that, but directions to do so are here: Auxiliary Parameters missed | TrueNAS Community
I assume it’s still there, but since it’s not really documented and I’ve never seen an “Enhanced Time Machine” preset, I’m not sure.
Aside: Do you ever notice how often investigations about a TrueNAS feature lead to a random forum thread that links to a a thread where someone drops the Undocumented Knowledge?
EDIT: Here’s another thread talking about how to access the SMB Aux parameters via CLI: SMB Shares Auxiliary Parameters - #2 by essinghigh - TrueNAS General - TrueNAS Community Forums .
I don’t think this should be necessary, but just in case anyone’s ever searching the forum for that, I wanted to include it.
2 Likes
Last I checked it is enabled by default when you setup a time machine share in the gui (I’ve sinced moved to freebsd but miss this specific feature). You can check if it’s in your setup by looking for the vfs object tmprotect
in your truenas’ smb4.conf
.
1 Like
Thanks! I haven’t set up the dataset yet, but I’ll check that file when I do. It’s not in there now, but I haven’t ever tried to use the TimeMachine preset on this machine.
Under SCALE 24.04, it’s under /etc/
.