LinuxCommandLibrary

virsh-pool-destroy

Deactivate and delete a storage pool

TLDR

Stop a storage pool specified by name or UUID (determine using virsh pool-list)

$ virsh pool-destroy --pool [name|uuid]
copy

SYNOPSIS

virsh pool-destroy pool-name

PARAMETERS

pool-name
    The name of the storage pool to be destroyed. This name is case-sensitive and must correspond to an active pool managed by libvirt.

DESCRIPTION

The virsh pool-destroy command is used to destroy an existing storage pool managed by libvirt. Destroying a pool means it will be stopped (deactivated) and its association with libvirt removed. Crucially, depending on the pool type and its configuration, this action can also lead to the deletion of its underlying data (e.g., a directory pool might have its directory removed, an LVM pool might have its logical volumes deleted). This is an irreversible action and must be used with extreme caution to prevent unintended data loss. The pool must be active (started) for this command to succeed. If the pool is not started, virsh pool-undefine is the correct command to remove its definition from libvirt without affecting the underlying storage.

CAVEATS

Data Loss Warning: Destroying a storage pool can result in the irreversible deletion of all data contained within that pool. Always ensure you have backups or are certain you no longer need the data before proceeding.
Active Pool Requirement: This command only works on active (started) storage pools. If the pool is inactive, you must use virsh pool-undefine instead to remove its definition.
No Confirmation: virsh commands, including pool-destroy, typically do not prompt for confirmation before executing. Exercise extreme caution.

DIFFERENCE FROM <I>POOL-UNDEFINE</I>

It's crucial to distinguish between pool-destroy and pool-undefine.

pool-destroy: Stops an active pool and potentially deletes its underlying data and resources. It targets the physical storage.
pool-undefine: Removes the definition (XML configuration) of an inactive pool from libvirt's configuration without touching the underlying physical data or resources. It targets libvirt's knowledge of the pool.

TYPICAL WORKFLOW FOR COMPLETE REMOVAL

To completely remove a storage pool and its data, a common workflow involves:
1. virsh pool-destroy (to stop the active pool and potentially clear data)
2. virsh pool-undefine (to remove its XML definition from libvirt)

HISTORY

The libvirt project, and its command-line interface virsh, have been foundational for virtualization management on Linux systems for many years. Storage pool management commands, including pool-destroy, have been core components since the early days of libvirt's development and widespread adoption. Their functionality has remained consistent, adapting to new storage technologies while maintaining the fundamental actions of defining, activating, and destroying storage resources.

SEE ALSO

virsh(1), virsh pool-define(1), virsh pool-undefine(1), virsh pool-start(1), virsh pool-list(1), virsh pool-build(1)

Copied to clipboard