ZFS-DESTROY(8)
β¨ NAME β¨
zfs-destroy β destroy ZFS dataset, snapshots, or bookmark. Bestie, this is the page from the zfs-destroy(8) manual (System Manager's Manual), and it's literally the "delete it, your honor" command. π
π SYNOPSIS π
zfs destroy [-Rfnprv] filesystem|volume
zfs destroy [-Rdnprv] filesystem|volume@snap[%snap[,snap[%snap]]]β¦
zfs destroy filesystem|volume#bookmark
π¦ DESCRIPTION π¦
π zfs destroy [-Rfnprv] filesystem|volume
Okay so this form yeets the given dataset into the void. By default it unshares any file systems that are currently shared, unmounts any file systems that are currently mounted, and refuses to destroy a dataset that has active dependents (that's children or clones, iykyk). It's giving "I'm not doing this unless everything is chill." π
-Rβ Recursively destroy all dependents, including cloned file systems outside the target hierarchy. Yes, outside. The audacity. π-fβ Forcibly unmount file systems. Heads up bestie: this option has no effect on non-file systems or on file systems that are already unmounted.-nβ Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in conjunction with the-vor-pflags to determine what data <em>would</em> be deleted. It's the "window shopping" of destruction. ποΈ-pβ Print machine-parsable verbose information about the deleted data. Robots love this one. π€-rβ Recursively destroy all children.-vβ Print verbose information about the deleted data.
β οΈ Extreme care should be taken when applying either the-ror the-Roptions, as they can destroy large portions of a pool and cause unexpected behavior for mounted file systems in use. Like, fr fr, this is the part where you double-check the pool name before you hit enter. No cap. π
π zfs destroy [-Rdnprv] filesystem|volume@snap[%snap[,snap[%snap]]]β¦
Attempts to destroy the given snapshot(s). This will fail if any clones of the snapshot exist or if the snapshot is held. In this case, by default, zfs destroy will have no effect and exit in error. But if the -d option is applied, the command will instead mark the given snapshot for automatic destruction as soon as it becomes eligible. While marked for destruction, a snapshot remains visible, and the user may create new clones from it and place new holds on it. It's basically "on read, but not blocked." π
The read-only snapshot properties defer_destroy and userrefs are used by zfs destroy to determine eligibility and marked status.
An inclusive range of snapshots may be specified by separating the first and last snapshots with a percent sign. The first and/or last snapshots may be left blank, in which case the filesystem's oldest or newest snapshot will be implied. Blank = "surprise me." π
Multiple snapshots (or ranges of snapshots) of the same filesystem or volume may be specified in a comma-separated list of snapshots. Only the snapshot's short name (the part after the @) should be specified when using a range or comma-separated list to identify multiple snapshots. Short name only, bestie, we're not doing full paths here.
-Rβ Recursively destroy all clones of these snapshots, including the clones, snapshots, and children. If this flag is specified, the-dflag will have no effect. Sorry-d, you're cancelled. π«-dβ Rather than returning error if the given snapshot is ineligible for immediate destruction, mark it for deferred, automatic destruction once it becomes eligible. The "we'll get to it" option. β¨-nβ Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in conjunction with the-por-vflags to determine what data would be deleted.-pβ Print machine-parsable verbose information about the deleted data.-rβ Destroy (or mark for deferred deletion) all snapshots with this name in descendent file systems.-vβ Print verbose information about the deleted data.
β οΈ Extreme care should be taken when applying either the-ror the-Roptions, as they can destroy large portions of a pool and cause unexpected behavior for mounted file systems in use. Same warning, same energy, still terrifying. π
π zfs destroy filesystem|volume#bookmark
The given bookmark is destroyed. That's it, that's the whole thing. Short and iconic. π
π EXAMPLES π
πΈ Example 1: Creating and Destroying Multiple Snapshots
The following command creates snapshots named yesterday of pool/home and all of its descendent file systems. Each snapshot is mounted on demand in the .zfs/snapshot directory at the root of its file system. The second command destroys the newly created snapshots. Create, then delete. The circle of life. π¦
# zfs snapshot -r pool/home@yesterday
# zfs destroy -r pool/home@yesterday
πΈ Example 2: Promoting a ZFS Clone
The following commands illustrate how to test out changes to a file system, and then replace the original file system with the changed one, using clones, clone promotion, and renaming. Main character energy for beta, honestly. π
# zfs create pool/project/production
populate /pool/project/production with data
# zfs snapshot pool/project/production@today
# zfs clone pool/project/production@today pool/project/beta
make changes to /pool/project/beta and test them
# zfs promote pool/project/beta
# zfs rename pool/project/production pool/project/legacy
# zfs rename pool/project/beta pool/project/production
once the legacy version is no longer needed, it can be destroyed
# zfs destroy pool/project/legacy
πΈ Example 3: Performing a Rolling Snapshot
The following example shows how to maintain a history of snapshots with a consistent naming scheme. To keep a week's worth of snapshots, the user destroys the oldest snapshot, renames the remaining snapshots, and then creates a new snapshot, as follows. It's a whole routine, and honestly? Obsessed. β¨
# zfs destroy -r pool/users@7daysago
# zfs rename -r pool/users@6daysago @7daysago
# zfs rename -r pool/users@5daysago @6daysago
# zfs rename -r pool/users@4daysago @5daysago
# zfs rename -r pool/users@3daysago @4daysago
# zfs rename -r pool/users@2daysago @3daysago
# zfs rename -r pool/users@yesterday @2daysago
# zfs rename -r pool/users@today @yesterday
# zfs snapshot -r pool/users@today
π SEE ALSO π
zfs-create(8)zfs-hold(8)zfsprops(8)
Okay bestie, that's the whole page! This one came to you from OpenZFS, dated February 5, 2025 β so if you remembered any of this, thank the OpenZFS girlies, and if you destroy the wrong dataset, that's on you, not on me. π«Ά Stay slay, back up your pool, and read the warnings twice. Periodt. πππΈ
π¦ where this page comes from
- alpine 3.23: zfs-doc 2.4.4-r0 Β· CDDL-1.0
- alpine 3.24: zfs-doc 2.4.4-r0 Β· CDDL-1.0
- nixos 26.05: zfs-user 2.4.4
- nixpkgs unstable: zfs-user 2.4.4
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5 Β· CDDL-1.0
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5.1 Β· CDDL-1.0
- ubuntu stonking: zfsutils-linux 2.4.4-1ubuntu4 Β· CDDL-1.0
- π the page's license: CDDL-1.0
- Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved
- Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
- Copyright (c) 2011, 2019 by Delphix. All rights reserved
- Copyright (c) 2013 by Saso Kiselkov. All rights reserved
- Copyright (c) 2014, Joyent, Inc. All rights reserved
- Copyright (c) 2014 by Adam Stevko. All rights reserved
- Copyright (c) 2014 Integros [integros.com]
- Copyright 2019 Richard Laager. All rights reserved
- Copyright 2018 Nexenta Systems, Inc
- Copyright 2019 Joyent, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms