Project

General

Profile

Feature #3696

want a way to roll back a zfs clone to its origin

Added by Gordon Ross over 7 years ago. Updated about 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2013-04-05
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

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.

#1

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).

#2

Updated by Andrey Kachalin over 4 years ago

You can rollback the clone using the following steps:

# promote clone to "move" snapshot to it
zfs promote pool/clone-fs
# rollback to that snapshot
zfs rollback pool/clone-fs@origin
# promote origin back
zfs promote pool/origin-fs

#3

Updated by Andriy Gapon about 4 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.

Also available in: Atom PDF