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