guidestorageReviewed July 15, 2026
Attach and detach guest disks safely
Device changes have two scopes: the active QEMU process and the persistent domain definition. State the intended scope before issuing the command. Preflight Attach in both scopes Confirm the guest sees the new block devi
attach-diskdetach-diskblocklive
Device changes have two scopes: the active QEMU process and the persistent domain definition. State the intended scope before issuing the command.
Preflight
BASH
virsh domblklist guest01 --details
qemu-img info /var/lib/libvirt/images/data01.qcow2
ls -lZ /var/lib/libvirt/images/data01.qcow2Attach in both scopes
BASH
virsh attach-disk guest01 /var/lib/libvirt/images/data01.qcow2 vdb \
--targetbus virtio --driver qemu --subdriver qcow2 --live --config
virsh domblklist guest01 --detailsConfirm the guest sees the new block device before creating filesystems or LVM structures.
Detach sequence
Unmount in the guest, stop applications, deactivate guest volume groups if applicable, then detach.
BASH
virsh detach-disk guest01 vdb --live --config
virsh domblklist guest01 --detailsDetaching a device is not data deletion. Remove the image only after ownership, retention, and recovery requirements are settled.