zfs.resource.snapshot.destroy

Destroy ZFS snapshots.

Args: data: Destroy parameters containing: - path: Snapshot path (e.g., ‘pool/dataset@snapshot’) or dataset path when all_snapshots=True (e.g., ‘pool/dataset’). - recursive: Recursively destroy matching snapshots in child datasets. - all_snapshots: If True, path is a dataset and all its snapshots are destroyed. - defer: Defer destruction if snapshot is in use (e.g., has clones).

Returns: None on success.

Raises: ValidationError: If snapshot not found, has clones (without defer), or has holds.

Examples: # Destroy a single snapshot destroy({“path”: “tank/data@backup”})

# Destroy recursively (all matching child snapshots) destroy({“path”: “tank@backup”, “recursive”: True})

# Defer destruction if in use destroy({“path”: “tank/data@snap”, “defer”: True})

# Destroy all snapshots for a dataset destroy({“path”: “tank/data”, “all_snapshots”: True})

# Destroy all snapshots for a dataset and its children destroy({“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