xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-destroy.8 (revision eda14cbc264d6969b02f2b1994cef11148e914f1)
1*eda14cbcSMatt Macy.\"
2*eda14cbcSMatt Macy.\" CDDL HEADER START
3*eda14cbcSMatt Macy.\"
4*eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
5*eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License").
6*eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License.
7*eda14cbcSMatt Macy.\"
8*eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*eda14cbcSMatt Macy.\" or http://www.opensolaris.org/os/licensing.
10*eda14cbcSMatt Macy.\" See the License for the specific language governing permissions
11*eda14cbcSMatt Macy.\" and limitations under the License.
12*eda14cbcSMatt Macy.\"
13*eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each
14*eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the
16*eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying
17*eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner]
18*eda14cbcSMatt Macy.\"
19*eda14cbcSMatt Macy.\" CDDL HEADER END
20*eda14cbcSMatt Macy.\"
21*eda14cbcSMatt Macy.\"
22*eda14cbcSMatt Macy.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
23*eda14cbcSMatt Macy.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
24*eda14cbcSMatt Macy.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
25*eda14cbcSMatt Macy.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
26*eda14cbcSMatt Macy.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
27*eda14cbcSMatt Macy.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
28*eda14cbcSMatt Macy.\" Copyright (c) 2014 Integros [integros.com]
29*eda14cbcSMatt Macy.\" Copyright 2019 Richard Laager. All rights reserved.
30*eda14cbcSMatt Macy.\" Copyright 2018 Nexenta Systems, Inc.
31*eda14cbcSMatt Macy.\" Copyright 2019 Joyent, Inc.
32*eda14cbcSMatt Macy.\"
33*eda14cbcSMatt Macy.Dd June 30, 2019
34*eda14cbcSMatt Macy.Dt ZFS-DESTROY 8
35*eda14cbcSMatt Macy.Os
36*eda14cbcSMatt Macy.Sh NAME
37*eda14cbcSMatt Macy.Nm zfs Ns Pf - Cm destroy
38*eda14cbcSMatt Macy.Nd Destroys the given dataset(s), snapshot(s), or bookmark.
39*eda14cbcSMatt Macy.Sh SYNOPSIS
40*eda14cbcSMatt Macy.Nm
41*eda14cbcSMatt Macy.Cm destroy
42*eda14cbcSMatt Macy.Op Fl Rfnprv
43*eda14cbcSMatt Macy.Ar filesystem Ns | Ns Ar volume
44*eda14cbcSMatt Macy.Nm
45*eda14cbcSMatt Macy.Cm destroy
46*eda14cbcSMatt Macy.Op Fl Rdnprv
47*eda14cbcSMatt Macy.Ar filesystem Ns | Ns Ar volume Ns @ Ns Ar snap Ns
48*eda14cbcSMatt Macy.Oo % Ns Ar snap Ns Oo , Ns Ar snap Ns Oo % Ns Ar snap Oc Oc Oc Ns ...
49*eda14cbcSMatt Macy.Nm
50*eda14cbcSMatt Macy.Cm destroy
51*eda14cbcSMatt Macy.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
52*eda14cbcSMatt Macy.Sh DESCRIPTION
53*eda14cbcSMatt Macy.Bl -tag -width ""
54*eda14cbcSMatt Macy.It Xo
55*eda14cbcSMatt Macy.Nm
56*eda14cbcSMatt Macy.Cm destroy
57*eda14cbcSMatt Macy.Op Fl Rfnprv
58*eda14cbcSMatt Macy.Ar filesystem Ns | Ns Ar volume
59*eda14cbcSMatt Macy.Xc
60*eda14cbcSMatt MacyDestroys the given dataset.
61*eda14cbcSMatt MacyBy default, the command unshares any file systems that are currently shared,
62*eda14cbcSMatt Macyunmounts any file systems that are currently mounted, and refuses to destroy a
63*eda14cbcSMatt Macydataset that has active dependents
64*eda14cbcSMatt Macy.Pq children or clones .
65*eda14cbcSMatt Macy.Bl -tag -width "-R"
66*eda14cbcSMatt Macy.It Fl R
67*eda14cbcSMatt MacyRecursively destroy all dependents, including cloned file systems outside the
68*eda14cbcSMatt Macytarget hierarchy.
69*eda14cbcSMatt Macy.It Fl f
70*eda14cbcSMatt MacyForce an unmount of any file systems using the
71*eda14cbcSMatt Macy.Nm unmount Fl f
72*eda14cbcSMatt Macycommand.
73*eda14cbcSMatt MacyThis option has no effect on non-file systems or unmounted file systems.
74*eda14cbcSMatt Macy.It Fl n
75*eda14cbcSMatt MacyDo a dry-run
76*eda14cbcSMatt Macy.Pq Qq No-op
77*eda14cbcSMatt Macydeletion.
78*eda14cbcSMatt MacyNo data will be deleted.
79*eda14cbcSMatt MacyThis is useful in conjunction with the
80*eda14cbcSMatt Macy.Fl v
81*eda14cbcSMatt Macyor
82*eda14cbcSMatt Macy.Fl p
83*eda14cbcSMatt Macyflags to determine what data would be deleted.
84*eda14cbcSMatt Macy.It Fl p
85*eda14cbcSMatt MacyPrint machine-parsable verbose information about the deleted data.
86*eda14cbcSMatt Macy.It Fl r
87*eda14cbcSMatt MacyRecursively destroy all children.
88*eda14cbcSMatt Macy.It Fl v
89*eda14cbcSMatt MacyPrint verbose information about the deleted data.
90*eda14cbcSMatt Macy.El
91*eda14cbcSMatt Macy.Pp
92*eda14cbcSMatt MacyExtreme care should be taken when applying either the
93*eda14cbcSMatt Macy.Fl r
94*eda14cbcSMatt Macyor the
95*eda14cbcSMatt Macy.Fl R
96*eda14cbcSMatt Macyoptions, as they can destroy large portions of a pool and cause unexpected
97*eda14cbcSMatt Macybehavior for mounted file systems in use.
98*eda14cbcSMatt Macy.It Xo
99*eda14cbcSMatt Macy.Nm
100*eda14cbcSMatt Macy.Cm destroy
101*eda14cbcSMatt Macy.Op Fl Rdnprv
102*eda14cbcSMatt Macy.Ar filesystem Ns | Ns Ar volume Ns @ Ns Ar snap Ns
103*eda14cbcSMatt Macy.Oo % Ns Ar snap Ns Oo , Ns Ar snap Ns Oo % Ns Ar snap Oc Oc Oc Ns ...
104*eda14cbcSMatt Macy.Xc
105*eda14cbcSMatt MacyThe given snapshots are destroyed immediately if and only if the
106*eda14cbcSMatt Macy.Ql zfs destroy
107*eda14cbcSMatt Macycommand without the
108*eda14cbcSMatt Macy.Fl d
109*eda14cbcSMatt Macyoption would have destroyed it.
110*eda14cbcSMatt MacySuch immediate destruction would occur, for example, if the snapshot had no
111*eda14cbcSMatt Macyclones and the user-initiated reference count were zero.
112*eda14cbcSMatt Macy.Pp
113*eda14cbcSMatt MacyIf a snapshot does not qualify for immediate destruction, it is marked for
114*eda14cbcSMatt Macydeferred deletion.
115*eda14cbcSMatt MacyIn this state, it exists as a usable, visible snapshot until both of the
116*eda14cbcSMatt Macypreconditions listed above are met, at which point it is destroyed.
117*eda14cbcSMatt Macy.Pp
118*eda14cbcSMatt MacyAn inclusive range of snapshots may be specified by separating the first and
119*eda14cbcSMatt Macylast snapshots with a percent sign.
120*eda14cbcSMatt MacyThe first and/or last snapshots may be left blank, in which case the
121*eda14cbcSMatt Macyfilesystem's oldest or newest snapshot will be implied.
122*eda14cbcSMatt Macy.Pp
123*eda14cbcSMatt MacyMultiple snapshots
124*eda14cbcSMatt Macy.Pq or ranges of snapshots
125*eda14cbcSMatt Macyof the same filesystem or volume may be specified in a comma-separated list of
126*eda14cbcSMatt Macysnapshots.
127*eda14cbcSMatt MacyOnly the snapshot's short name
128*eda14cbcSMatt Macy.Po the part after the
129*eda14cbcSMatt Macy.Sy @
130*eda14cbcSMatt Macy.Pc
131*eda14cbcSMatt Macyshould be specified when using a range or comma-separated list to identify
132*eda14cbcSMatt Macymultiple snapshots.
133*eda14cbcSMatt Macy.Bl -tag -width "-R"
134*eda14cbcSMatt Macy.It Fl R
135*eda14cbcSMatt MacyRecursively destroy all clones of these snapshots, including the clones,
136*eda14cbcSMatt Macysnapshots, and children.
137*eda14cbcSMatt MacyIf this flag is specified, the
138*eda14cbcSMatt Macy.Fl d
139*eda14cbcSMatt Macyflag will have no effect.
140*eda14cbcSMatt Macy.It Fl d
141*eda14cbcSMatt MacyDestroy immediately. If a snapshot cannot be destroyed now, mark it for
142*eda14cbcSMatt Macydeferred destruction.
143*eda14cbcSMatt Macy.It Fl n
144*eda14cbcSMatt MacyDo a dry-run
145*eda14cbcSMatt Macy.Pq Qq No-op
146*eda14cbcSMatt Macydeletion.
147*eda14cbcSMatt MacyNo data will be deleted.
148*eda14cbcSMatt MacyThis is useful in conjunction with the
149*eda14cbcSMatt Macy.Fl p
150*eda14cbcSMatt Macyor
151*eda14cbcSMatt Macy.Fl v
152*eda14cbcSMatt Macyflags to determine what data would be deleted.
153*eda14cbcSMatt Macy.It Fl p
154*eda14cbcSMatt MacyPrint machine-parsable verbose information about the deleted data.
155*eda14cbcSMatt Macy.It Fl r
156*eda14cbcSMatt MacyDestroy
157*eda14cbcSMatt Macy.Pq or mark for deferred deletion
158*eda14cbcSMatt Macyall snapshots with this name in descendent file systems.
159*eda14cbcSMatt Macy.It Fl v
160*eda14cbcSMatt MacyPrint verbose information about the deleted data.
161*eda14cbcSMatt Macy.Pp
162*eda14cbcSMatt MacyExtreme care should be taken when applying either the
163*eda14cbcSMatt Macy.Fl r
164*eda14cbcSMatt Macyor the
165*eda14cbcSMatt Macy.Fl R
166*eda14cbcSMatt Macyoptions, as they can destroy large portions of a pool and cause unexpected
167*eda14cbcSMatt Macybehavior for mounted file systems in use.
168*eda14cbcSMatt Macy.El
169*eda14cbcSMatt Macy.It Xo
170*eda14cbcSMatt Macy.Nm
171*eda14cbcSMatt Macy.Cm destroy
172*eda14cbcSMatt Macy.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
173*eda14cbcSMatt Macy.Xc
174*eda14cbcSMatt MacyThe given bookmark is destroyed.
175*eda14cbcSMatt Macy.El
176*eda14cbcSMatt Macy.Sh SEE ALSO
177*eda14cbcSMatt Macy.Xr zfs-create 8 ,
178*eda14cbcSMatt Macy.Xr zfs-hold 8
179