Recursive rollback? Am I asking the right question?

Joined
Oct 22, 2019
Messages
3,641
I've used the rollback feature to go back to a point in time for a specific dataset. No problems there.

If I create a recursive snapshot of an entire pool (all child datasets included), it creates a snapshot for each child dataset within the entire pool.

So far, so good.

Yet if I rollback the top level snapshot (of the pool itself), it does not rollback all the other snapshots of the same name for the child datasets.

Here is an example:

----------

mainpool
mainpool/linuxdistros
mainpool/archives
mainpool/downloads
mainpool/downloads/small
mainpool/downloads/large


I create a recursive snapshot for mainpool named @manual-20191108.

Now I have the following snapshots:

mainpool@manual-20191108
mainpool/linuxdistros@manual-20191108
mainpool/archives@manual-20191108
mainpool/downloads@manual-20191108
mainpool/downloads/small@manual-20191108
mainpool/downloads/large@manual-20191108


If I select mainpool@manual-20191108, and rollback to this snapshot, none of the child datasets are rolled back to the same snapshot.

I searched online in these forums and on the Oracle documentations, but could not find a clear answer. How would I do a "recursive rollback", if that even makes sense? It is possible through the FreeNAS web GUI? Through a single command?
 

garm

Wizard
Joined
Aug 19, 2017
Messages
1,556
Rollback is an extreme action and as far as I’m aware can only be done per dataset. Your workflow should consider a rollback to be a catastrophic last resort (think ransomware or rebuild of a lost pool). In daily use it’s way safer to mount snapshots and restore specific data, also a per dataset action.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
A search for "zfs recursive rollback" will turn up several different scripts that will help with recursive rollbacks. Ultimately I think it's probably a good thing that this isn't a native feature. There are just too many places where this could lead to unintended destruction with the way dependent datasets could be destroyed as well.

As for "daily use", I find it way easier and just as safe to restore files from the ".zfs/snapshot/<snapshot_name>" directories.

A rollback did recently save me from an incompatibility introduced by a package upgrade in a jail.
 

garm

Wizard
Joined
Aug 19, 2017
Messages
1,556
A rollback did recently save me from an incompatibility introduced by a package upgrade in a jail.
Or this, I do this fairly regularly as well. I consider this catastrophic server failure.
 
Top