Trigger ZFS snapshot upon completion of a Time Machine backup?

seanm

Guru
Joined
Jun 11, 2018
Messages
570
Is there any way for the completion of a Time Machine backup to trigger a ZFS snapshot to be created?

Of course I can (and do) take frequent automated snapshots, but a snapshot that occurs while Time Machine is in the middle of its work is less useful, since it's probably in some half-complete state.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
Is there any way for the completion of a Time Machine backup to trigger a ZFS snapshot to be created?

Of course I can (and do) take frequent automated snapshots, but a snapshot that occurs while Time Machine is in the middle of its work is less useful, since it's probably in some half-complete state.
One of the next features I will add is the ability to add proper FSRVP support using libzfs in samba. If you can convince Apple to speak that protocol (or send something else when TM backups are done) I could probably do something about it. As things stand, Time Machine behavior is rather opaque on the NAS side.
 

seanm

Guru
Joined
Jun 11, 2018
Messages
570
You mean there's no way currently to detect that TM is done? Does it not close its socket?
 

seanm

Guru
Joined
Jun 11, 2018
Messages
570
Ah ha, that does indeed look like a mechanism that could be used, thanks for pointing it out, I'll read up on it.

Mine is not a home environment. Perhaps I'll try adding one of these 'root postexec' scripts that just logs, to see how I fare with that...
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
When I was running TimeMachine backups to my FreeNAS share I had a script monitoring the log file (I forget which one). When backupd wrote out that it was complete, the script would connect to FreeNAS and make a snapshot.
I can see if I can dig up that script if you're interested.
I have to say the postexec script sounds like a better option.
 

seanm

Guru
Joined
Jun 11, 2018
Messages
570
@fracai, and that script ran on the Mac, right? I have about a dozen Macs Time Machining, so a single postexec script on the server does seem more managable, but thanks!
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
correct, it ran on the Mac. I'll dig it up and post it just to have it out in the world, but I like the idea of the script. I hope you post what you put together.
 

seanm

Guru
Joined
Jun 11, 2018
Messages
570
I probably won't get around to trying for a few weeks, but will certainly post back here when I do.
 
Top