libvirt manages VM disks through storage pools (where disks live) and volumes (the disks themselves). Understanding libvirt storage pools lets you mix local files, LVM, NFS and distributed storage with the same tools.
Before you start
- A KVM host with libvirt; see install KVM on Ubuntu.
- Background on formats: qcow2 vs raw.
Pool types
| Type | Backed by | Volumes are | Notes |
|---|---|---|---|
| dir | A local directory | qcow2/raw files | Default pool at /var/lib/libvirt/images |
| logical | LVM volume group | Logical volumes | Fast block storage; see LVM pool |
| netfs | NFS (or other network FS) | Files | Shared storage for migration; see NFS storage |
| iscsi / iscsi-direct | iSCSI target | LUNs | See iSCSI |
| zfs | A ZFS pool | zvols | Snapshots, compression; see ZFS for VMs |
| rbd | Ceph cluster | RBD images | Distributed; see Ceph |
| disk / fs | Whole disk or a device with a filesystem | Partitions / files | Less common |
Common commands
virsh pool-list --all --detailsvirsh pool-info defaultvirsh vol-list default --detailsCreate a volume and delete one:
virsh vol-create-as default app01.qcow2 30G --format qcow2virsh vol-delete app01.qcow2 --pool defaultDefine a new directory pool
virsh pool-define-as fastpool dir --target /srv/vm-fastvirsh pool-build fastpool && virsh pool-start fastpool && virsh pool-autostart fastpoolDefine a ZFS pool
virsh pool-define-as zpool zfs --source-name vmpoolThis assumes an existing ZFS pool named vmpool; libvirt will create zvols in it. ZFS support requires libvirt built with the ZFS backend.
Refresh after external changes
If you create files or LVs outside libvirt, refresh so they appear:
virsh pool-refresh defaultChoosing
- Single host, simple: dir with qcow2 or logical with raw.
- Snapshots and integrity: ZFS.
- Live migration across hosts: netfs, iSCSI with shared LVM, or RBD.
Troubleshooting
- Pool inactive after reboot: run
virsh pool-autostart. - "storage pool does not support volume creation": some types (like iscsi) only expose existing LUNs.
- Permission errors: check ownership and SELinux/AppArmor labels on the target path.
Frequently asked questions
Do I need pools at all?
No, VMs can reference disk paths directly, but pools make management and tooling easier.
Can one VM use disks from several pools?
Yes, each disk can come from a different pool.
How do VPS panels handle storage?
They usually manage LVM, ZFS or files themselves; see VirtFusion storage.
