Where Does libvirt Store KVM Disk Images and Configs?
libvirt keeps VM disk images in /var/lib/libvirt/images and domain XML under /etc/libvirt. Images, configs, logs and pools.
Last updated
libvirt's storage has a simple split: disk images live in the default pool at /var/lib/libvirt/images, while domain definitions live as XML files under /etc/libvirt/qemu. Storage pool definitions sit beside them under /etc/libvirt/storage. Learn those three spots and every virsh error starts making sense.
The gotcha is that the XML files are a live database, not config you edit freely; use virsh edit so changes validate. Disk images outside the default pool also need matching ownership and SELinux labels or guests refuse to start. Per-guest logs at /var/log/libvirt/qemu name the exact complaint when that happens.
Where libvirt QEMU KVM stores this, by platform
/var/lib/libvirt/images
Default storage pool for qcow2 and raw images. Domain XML lives in /etc/libvirt/qemu, pool definitions in /etc/libvirt/storage, driver config at /etc/libvirt/qemu.conf, and per-guest logs at /var/log/libvirt/qemu/[name].log. Session URIs (qemu:///session) use ~/.config/libvirt and home-directory images instead; everything above describes the system URI.
Frequently asked questions
why does libvirt say permission denied on my disk image
Permission denied on a custom path is almost always ownership or SELinux labeling, not a broken image. The qemu user must own the path, and on SELinux systems the directory needs the virt_image_t label that /var/lib/libvirt/images already has. Moving the image into the default pool sidesteps both issues at once.
how do i run libvirt vms without root
Use qemu:///session instead of qemu:///system. The user session stores images in your home directory and configs under ~/.config/libvirt, with no root needed. The tradeoff is networking: the default NAT network of the system session is unavailable, so bridged setups need extra work.
can i edit libvirt xml files directly
The XML files are libvirt's live record, so hand-editing them behind its back gets overwritten or rejected. Use virsh edit, which validates before saving, or virsh dumpxml piped to virsh define. virt-manager's XML view edits the same record safely.
Notice an outdated path? Let us know.