zfs.resource.destroy

Destroy a ZFS resource (filesystem or volume), optionally recursing into its descendants.

To destroy snapshots, use zfs.resource.snapshot.destroy instead.

Warning

The shares, tasks, iSCSI extents, NVMe-oF namespaces, VM devices and apps that use the resource or any of its descendants are deleted before it is destroyed, once the request has passed validation.

A validation error is raised when:

  • a snapshot path (containing @) is supplied (use zfs.resource.snapshot.destroy)

  • the resource does not exist (ENOENT)

  • the resource has children and recursive is false (EBUSY)

  • the resource has snapshots and recursive is false

  • the target is the pool’s root filesystem

  • the path is absolute or ends with /

  • the path references a protected internal resource

Examples:

Destroy a single filesystem:

{"path": "tank/temp"}

Recursively destroy a filesystem and all of its descendants:

{"path": "tank/parent", "recursive": true}

Note

  • Root filesystem destruction is not allowed for safety

  • Protected system paths cannot be destroyed via API

  • Datasets with snapshots require recursive to be true

Type: object

Type: array
No Additional Items

Tuple Validation

Parameter 1: data

data

Type: object

Parameters.

No Additional Properties

Path

Type: string

Path of the zfs resource (dataset or volume) to be destroyed. Must be of the form 'pool/name'. It cannot be an absolute path or end with '/'. Snapshot paths (containing '@') are not accepted. One must use zfs.resource.snapshot.destroy instead.

Must be at least 1 characters long

Recursive

Type: boolean Default: false

Recursively destroy all descendants of the resource, including child datasets, snapshots, clones, and holds.

Result

Type: null


Required roles: ZFS_RESOURCE_DELETE