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