xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-destroy.8 (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
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 http://www.opensolaris.org/os/licensing.
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.\"
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 June 30, 2019
34.Dt ZFS-DESTROY 8
35.Os
36.Sh NAME
37.Nm zfs-destroy
38.Nd Destroys the given dataset(s), snapshot(s), or bookmark.
39.Sh SYNOPSIS
40.Nm zfs
41.Cm destroy
42.Op Fl Rfnprv
43.Ar filesystem Ns | Ns Ar volume
44.Nm zfs
45.Cm destroy
46.Op Fl Rdnprv
47.Ar filesystem Ns | Ns Ar volume Ns @ Ns Ar snap Ns
48.Oo % Ns Ar snap Ns Oo , Ns Ar snap Ns Oo % Ns Ar snap Oc Oc Oc Ns ...
49.Nm zfs
50.Cm destroy
51.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
52.Sh DESCRIPTION
53.Bl -tag -width ""
54.It Xo
55.Nm zfs
56.Cm destroy
57.Op Fl Rfnprv
58.Ar filesystem Ns | Ns Ar volume
59.Xc
60Destroys the given dataset.
61By default, the command unshares any file systems that are currently shared,
62unmounts any file systems that are currently mounted, and refuses to destroy a
63dataset that has active dependents
64.Pq children or clones .
65.Bl -tag -width "-R"
66.It Fl R
67Recursively destroy all dependents, including cloned file systems outside the
68target hierarchy.
69.It Fl f
70Force an unmount of any file systems using the
71.Nm unmount Fl f
72command.
73This option has no effect on non-file systems or unmounted file systems.
74.It Fl n
75Do a dry-run
76.Pq Qq No-op
77deletion.
78No data will be deleted.
79This is useful in conjunction with the
80.Fl v
81or
82.Fl p
83flags to determine what data would be deleted.
84.It Fl p
85Print machine-parsable verbose information about the deleted data.
86.It Fl r
87Recursively destroy all children.
88.It Fl v
89Print verbose information about the deleted data.
90.El
91.Pp
92Extreme care should be taken when applying either the
93.Fl r
94or the
95.Fl R
96options, as they can destroy large portions of a pool and cause unexpected
97behavior for mounted file systems in use.
98.It Xo
99.Nm zfs
100.Cm destroy
101.Op Fl Rdnprv
102.Ar filesystem Ns | Ns Ar volume Ns @ Ns Ar snap Ns
103.Oo % Ns Ar snap Ns Oo , Ns Ar snap Ns Oo % Ns Ar snap Oc Oc Oc Ns ...
104.Xc
105The given snapshots are destroyed immediately if and only if the
106.Ql zfs destroy
107command without the
108.Fl d
109option would have destroyed it.
110Such immediate destruction would occur, for example, if the snapshot had no
111clones and the user-initiated reference count were zero.
112.Pp
113If a snapshot does not qualify for immediate destruction, it is marked for
114deferred deletion.
115In this state, it exists as a usable, visible snapshot until both of the
116preconditions listed above are met, at which point it is destroyed.
117.Pp
118An inclusive range of snapshots may be specified by separating the first and
119last snapshots with a percent sign.
120The first and/or last snapshots may be left blank, in which case the
121filesystem's oldest or newest snapshot will be implied.
122.Pp
123Multiple snapshots
124.Pq or ranges of snapshots
125of the same filesystem or volume may be specified in a comma-separated list of
126snapshots.
127Only the snapshot's short name
128.Po the part after the
129.Sy @
130.Pc
131should be specified when using a range or comma-separated list to identify
132multiple snapshots.
133.Bl -tag -width "-R"
134.It Fl R
135Recursively destroy all clones of these snapshots, including the clones,
136snapshots, and children.
137If this flag is specified, the
138.Fl d
139flag will have no effect.
140.It Fl d
141Destroy immediately. If a snapshot cannot be destroyed now, mark it for
142deferred destruction.
143.It Fl n
144Do a dry-run
145.Pq Qq No-op
146deletion.
147No data will be deleted.
148This is useful in conjunction with the
149.Fl p
150or
151.Fl v
152flags to determine what data would be deleted.
153.It Fl p
154Print machine-parsable verbose information about the deleted data.
155.It Fl r
156Destroy
157.Pq or mark for deferred deletion
158all snapshots with this name in descendent file systems.
159.It Fl v
160Print verbose information about the deleted data.
161.Pp
162Extreme care should be taken when applying either the
163.Fl r
164or the
165.Fl R
166options, as they can destroy large portions of a pool and cause unexpected
167behavior for mounted file systems in use.
168.El
169.It Xo
170.Nm zfs
171.Cm destroy
172.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark
173.Xc
174The given bookmark is destroyed.
175.El
176.Sh SEE ALSO
177.Xr zfs-create 8 ,
178.Xr zfs-hold 8
179