zfs.resource.snapshot.destroy

Destroy ZFS snapshots.

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:

  • the snapshot does not exist (ENOENT)

  • it has dependent clones and defer is false (ENOTEMPTY)

  • it has active holds (ENOTEMPTY)

  • a protected path is targeted without bypass (EACCES)

Examples:

Destroy a single snapshot:

{"path": "tank/data@backup"}

Destroy matching snapshots in child datasets:

{"path": "tank@backup", "recursive": true}

Defer destruction if the snapshot is in use:

{"path": "tank/data@snap", "defer": true}

Destroy all snapshots of a dataset:

{"path": "tank/data", "all_snapshots": true}

Destroy all snapshots of a dataset and its children:

{"path": "tank", "all_snapshots": true, "recursive": true}
Type: object

Type: array
No Additional Items

Tuple Validation

Parameter 1: data

data

Type: object

Destroy parameters for removing ZFS snapshots.

No Additional Properties

Path

Type: string

Path to destroy. Either a snapshot path (e.g., 'pool/dataset@snapshot') or a dataset path when all_snapshots=True (e.g., 'pool/dataset').

Must be at least 1 characters long

Recursive

Type: boolean Default: false

Recursively destroy matching snapshots in child datasets.

All Snapshots

Type: boolean Default: false

If True, path should be a dataset path and all its snapshots will be destroyed.

Defer

Type: boolean Default: false

Defer destruction if snapshot is in use (e.g., has clones).

Result

Type: null


Required roles: SNAPSHOT_DELETE