ZFS Switching between snapshots (confused newbie)

rustleg

New Member


Messages: 6

I installed the latest FreeBSD 11.1-RELEASE-p4 with ZFS on an entire SSD (to preserve my Linux system on another disk). I am reading the FreeBSD handbook about ZFS to understand snapshots before installing a graphical desktop so that I can try alternative desktops. I am confused as to how I might save one configuration as a snapshot, roll back to try another desktop then possibly revert to the earlier one.

The manual says in 19.4.5.3. Snapshot Rollback : "Taking a snapshot of the current state of the dataset before rolling back to a previous one is a good idea when some data is required later. This way, the user can roll back and forth between snapshots without losing data that is still valuable."

Then later in the same section it says: "It is also possible to roll back to a snapshot that was taken much earlier and has other snapshots that were created after it. When trying to do this, ZFS will issue this warning: ... cannot rollback to 'mypool/var/tmp@my_recursive_snapshot': more recent snapshots exist ... This warning means that snapshots exist between the current state of the dataset and the snapshot to which the user wants to roll back. To complete the rollback, these snapshots must be deleted."

So if I install desktop A and snapshot it, then install B and snapshot that one, if I want to revert to A does this mean I have to lose the ability to return later to snapshot B? Perhaps I need to understand clones?

Any pointers would be appreciated. If there's a HOWTO or similar document to read please refer me to it.
 

ANOKNUSA

Aspiring Daemon

Reaction score: 373
Messages: 675

Well, clones would be the thing you'd want to use if you wanted to switch between two distinct dataset states, yes. I wouldn't do it just to install two different desktops, since those can live side-by-side just fine and can easily be removed, but if you wanted to experiment with two different versions of a dataset without making a full copy of the original, a clone would be the way to do it.

If you're familiar with the common revision control systems like Mercurial and Git, then a ZFS snapshot would be a "commit" or "changeset," while a ZFS clone would be a branch. The limitation ZFS has is that rolling back a "commit" (snapshot) destroys every snapshot more recent than the one you're rolling back to.
 
Top