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