| ZFS-DESTROY(8) | System Manager's Manual | ZFS-DESTROY(8) | 
zfs-destroy —
    destroy ZFS dataset, snapshots, or bookmark
| zfs | destroy[-Rfnprv]
      filesystem|volume | 
| zfs | destroy[-Rdnprv]
      filesystem|volume@snap[%snap[,snap[%snap]]]… | 
| zfs | destroyfilesystem|volume#bookmark | 
zfs destroy
    [-Rfnprv]
    filesystem|volume-R-f-n-v or
          -p flags to determine what data would be
          deleted.-p-r-vExtreme care should be taken when applying either the
        -r or the -R options, as
        they can destroy large portions of a pool and cause unexpected behavior
        for mounted file systems in use.
zfs destroy
    [-Rdnprv]
    filesystem|volume@snap[%snap[,snap[%snap]]]…zfs destroy will have no
      effect and exit in error. 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.
    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.
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.
-R-d flag will have no effect.-d-n-p or
          -v flags to determine what data would be
          deleted.-p-r-vExtreme care should be taken when applying either the
        -r or the -R options, as
        they can destroy large portions of a pool and cause unexpected behavior
        for mounted file systems in use.
zfs destroy
    filesystem|volume#bookmarkThe 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.
# zfs
  snapshot -r
  pool/home@yesterday# zfs
  destroy -r
  pool/home@yesterdayThe 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:
#zfscreatepool/project/production populate /pool/project/production with data #zfssnapshotpool/project/production@today #zfsclonepool/project/production@today pool/project/beta make changes to /pool/project/beta and test them #zfspromotepool/project/beta #zfsrenamepool/project/production pool/project/legacy #zfsrenamepool/project/beta pool/project/production once the legacy version is no longer needed, it can be destroyed #zfsdestroypool/project/legacy
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:
#zfsdestroy-rpool/users@7daysago #zfsrename-rpool/users@6daysago @7daysago #zfsrename-rpool/users@5daysago @6daysago #zfsrename-rpool/users@4daysago @5daysago #zfsrename-rpool/users@3daysago @4daysago #zfsrename-rpool/users@2daysago @3daysago #zfsrename-rpool/users@yesterday @2daysago #zfsrename-rpool/users@today @yesterday #zfssnapshot-rpool/users@today
| March 16, 2022 | OpenZFS |