Skip to content

Commit d1b0c4e

Browse files
mnrxamotin
authored andcommitted
Clarify documentation of zfs destroy on snapshots (openzfs#17021)
The current documentation of `zfs destroy` in application to snapshots is particularly difficult to understand. The following changes are made: - Remove circular reference to `zfs destroy` in the documentation of that command. - Remove use of "for example", which implies there are more, undocumented reasons that ZFS may fail to destroy a snapshot immediately. - Mention properties `defer_destroy` and `userrefs`. - Add `zfsprops(8)` to "SEE ALSO" list. - Clarify meaning of `-d` option. Requires-builders: none Signed-off-by: mnrx <[email protected]> Co-authored-by: Alexander Motin <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: George Amanakis <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
1 parent 3266d4d commit d1b0c4e

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

man/man8/zfs-destroy.8

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,25 @@ behavior for mounted file systems in use.
101101
.Ar filesystem Ns | Ns Ar volume Ns @ Ns Ar snap Ns
102102
.Oo % Ns Ar snap Ns Oo , Ns Ar snap Ns Oo % Ns Ar snap Oc Oc Oc Ns
103103
.Xc
104-
The given snapshots are destroyed immediately if and only if the
104+
Attempts to destroy the given snapshot(s).
105+
This will fail if any clones of the snapshot exist or if the snapshot is held.
106+
In this case, by default,
105107
.Nm zfs Cm destroy
106-
command without the
108+
will have no effect and exit in error.
109+
If the
107110
.Fl d
108-
option would have destroyed it.
109-
Such immediate destruction would occur, for example, if the snapshot had no
110-
clones and the user-initiated reference count were zero.
111+
option is applied, the command will instead mark the given snapshot for
112+
automatic destruction as soon as it becomes eligible.
113+
While marked for destruction, a snapshot remains visible, and the user may
114+
create new clones from it and place new holds on it.
111115
.Pp
112-
If a snapshot does not qualify for immediate destruction, it is marked for
113-
deferred deletion.
114-
In this state, it exists as a usable, visible snapshot until both of the
115-
preconditions listed above are met, at which point it is destroyed.
116+
The read-only snapshot properties
117+
.Sy defer_destroy
118+
and
119+
.Sy userrefs
120+
are used by
121+
.Nm zfs Cm destroy
122+
to determine eligibility and marked status.
116123
.Pp
117124
An inclusive range of snapshots may be specified by separating the first and
118125
last snapshots with a percent sign.
@@ -137,8 +144,9 @@ If this flag is specified, the
137144
.Fl d
138145
flag will have no effect.
139146
.It Fl d
140-
Destroy immediately.
141-
If a snapshot cannot be destroyed now, mark it for deferred destruction.
147+
Rather than returning error if the given snapshot is ineligible for immediate
148+
destruction, mark it for deferred, automatic destruction once it becomes
149+
eligible.
142150
.It Fl n
143151
Do a dry-run
144152
.Pq Qq No-op
@@ -223,4 +231,5 @@ renames the remaining snapshots, and then creates a new snapshot, as follows:
223231
.
224232
.Sh SEE ALSO
225233
.Xr zfs-create 8 ,
226-
.Xr zfs-hold 8
234+
.Xr zfs-hold 8 ,
235+
.Xr zfsprops 8

0 commit comments

Comments
 (0)