Managing ZFS File Systems in Oracle® Solaris 11.2

Exit Print View

Updated: December 2014

Rolling Back a ZFS Snapshot

You can use the zfs rollback command to discard all changes made to a file system since a specific snapshot was created. The file system reverts to its state at the time the snapshot was taken. By default, the command cannot roll back to a snapshot other than the most recent snapshot.

To roll back to an earlier snapshot, all intermediate snapshots must be destroyed. You can destroy earlier snapshots by specifying the –r option.

If clones of any intermediate snapshots exist, the –R option must be specified to destroy the clones as well.

Note - The file system that you want to roll back is unmounted and remounted, if it is currently mounted. If the file system cannot be unmounted, the rollback fails. The –f option forces the file system to be unmounted, if necessary.

In the following example, the tank/home/cindy file system is rolled back to the tuesday snapshot:

# zfs rollback tank/home/cindy@tuesday
cannot rollback to 'tank/home/cindy@tuesday': more recent snapshots exist
use '-r' to force deletion of the following snapshots:
# zfs rollback -r tank/home/cindy@tuesday

In this example, the wednesday and thursday snapshots are destroyed because you rolled back to the earlier tuesday snapshot.

# zfs list -r -t snapshot -o name,creation tank/home/cindy
NAME                     CREATION
tank/home/cindy@tuesday  Fri Aug  3 15:18 2012