want a way to roll back a zfs clone to its origin
Sometimes, one would like a way to refer the the origin of a
cloned ZFS data set, i.e. for rollback or diff. If there were
perhaps a special name for the origin like ".origin" one could:
zfs diff pool/cloned-ws@.origin pool/cloned-ws zfs rollback pool/cloned-ws@.origin
Currently, the only way to do this rollback is to
destroy and re-create the clone.
Updated by Matthew Ahrens over 7 years ago
You can already do this with "zfs diff":
zfs diff pool/origin-fs@origin pool/clone
The rollback can be accomplished with the libzfs_core interface (lzc_rollback()), but there's no user interface. Perhaps we should expose the underlying primitive ("rollback to most recent snapshot") through the CLI. You could do "zfs rollback <fs|vol>" and it would roll back to the most recent snapshot (which could be the origin).
Updated by Andriy Gapon over 3 years ago
Andrey Kachalin wrote:
You can rollback the clone using the following steps:
Or even simpler:
zfs destroy pool/clone-fs zfs clone pool/clone-fs pool/clone-fs@origin
But that's non-atomic, of course.
Still would be nice if zfs rollback supported this scenario.