zfs.resource.destroy

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

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

Invalid input is returned to the client as a JSON-RPC error response (code -32602, Invalid params); each failing condition appears in the error’s data.extra array with its own errno. 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. Snapshot paths (containing '@') are not accepted - 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