2012-06-18 19:39, Paul Kraus wrote:
OK, I am a butt-head and accidentally destroyed my last snapshot of a
replicated ZFS dataset. The dataset is NOT mounted and other than a
resilver going on, there is no I/O going on to this dataset. Is there
any way to roll back and get my latest snapshot back?
AFAIK you can roll back the pool to one of the TXG numbers saved
in the uberblock ring (128 entries for 512b native sector disks,
32 entries for 4KB sectored disks). ZFS does not (yet) guarantee
that the freed blocks from those last N-127 TXGs won't be further
overwritten - these are not (yet) rolling snapshots, but there
are often good chances to pick a valid state (or one with few
errors; though checking for those may take long).
The problem is that the TXGs are synced to disk every 5 seconds
(or 30sec in some builds), which gives you about 10 minutes to
export the pool until you do rollbacks/repairs, or perhaps then
you can mount it read-only.
While undeletions might logically be done, or at least attempted,
i.e. to recover the deleted dataset (snapshot) while the rest of
the pool is not rolled back, I don't know of a mechanism for that.
As it stands now, rollbacks are one-way (uberblocks with newer
TXG numbers are, AFAIK, explicitly invalidated (zeroed out)).
I don't know how/if rollbacks work with read-only imports, if
they allow to inspect a pool at TXG number N without forfeiting
its newer changes.
zfs-discuss mailing list