1.\"
2.\" CDDL HEADER START
3.\"
4.\" The contents of this file are subject to the terms of the
5.\" Common Development and Distribution License (the "License").
6.\" You may not use this file except in compliance with the License.
7.\"
8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9.\" or https://opensource.org/licenses/CDDL-1.0.
10.\" See the License for the specific language governing permissions
11.\" and limitations under the License.
12.\"
13.\" When distributing Covered Code, include this CDDL HEADER in each
14.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15.\" If applicable, add the following below this CDDL HEADER, with the
16.\" fields enclosed by brackets "[]" replaced with your own identifying
17.\" information: Portions Copyright [yyyy] [name of copyright owner]
18.\"
19.\" CDDL HEADER END
20.\"
21.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
22.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
23.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
24.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
25.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
26.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
27.\" Copyright (c) 2014 Integros [integros.com]
28.\" Copyright 2019 Richard Laager. All rights reserved.
29.\" Copyright 2018 Nexenta Systems, Inc.
30.\" Copyright 2019 Joyent, Inc.
31.\"
32.Dd March 16, 2022
33.Dt ZFS-ROLLBACK 8
34.Os
35.
36.Sh NAME
37.Nm zfs-rollback
38.Nd roll ZFS dataset back to snapshot
39.Sh SYNOPSIS
40.Nm zfs
41.Cm rollback
42.Op Fl Rfr
43.Ar snapshot
44.
45.Sh DESCRIPTION
46When a dataset is rolled back, all data that has changed since the snapshot is
47discarded, and the dataset reverts to the state at the time of the snapshot.
48By default, the command refuses to roll back to a snapshot other than the most
49recent one.
50In order to do so, all intermediate snapshots and bookmarks must be destroyed by
51specifying the
52.Fl r
53option.
54.Pp
55The
56.Fl rR
57options do not recursively destroy the child snapshots of a recursive snapshot.
58Only direct snapshots of the specified filesystem are destroyed by either of
59these options.
60To completely roll back a recursive snapshot, you must roll back the individual
61child snapshots.
62.Bl -tag -width "-R"
63.It Fl R
64Destroy any more recent snapshots and bookmarks, as well as any clones of those
65snapshots.
66.It Fl f
67Used with the
68.Fl R
69option to force an unmount of any clone file systems that are to be destroyed.
70.It Fl r
71Destroy any snapshots and bookmarks more recent than the one specified.
72.El
73.
74.Sh EXAMPLES
75.\" These are, respectively, examples 8 from zfs.8
76.\" Make sure to update them bidirectionally
77.Ss Example 8 : No Rolling Back a ZFS File System
78The following command reverts the contents of
79.Ar pool/home/anne
80to the snapshot named
81.Ar yesterday ,
82deleting all intermediate snapshots:
83.Dl # Nm zfs Cm rollback Fl r Ar pool/home/anne Ns @ Ns Ar yesterday
84.
85.Sh SEE ALSO
86.Xr zfs-snapshot 8
87