kvmvirsh

KVM + virsh: the storage pool is empty


I am new to KVM and virsh command

I want to change my storage-pool to some other folder

but before that i dont see any default storage pool

$ virsh pool-list --all                

 Name   State   Autostart
---------------------------

the following happens when i try to dump xml (which i am trying to change default storage location)

$ virsh pool-dumpxml default > pool.xml
error: failed to get pool 'default'
error: Storage pool not found: no storage pool with matching name 'default'

Solution

  • Here you can create a new default storage pool:

    1. create a new directory for the storage pool - here "homelab" will be used as an example.

      $ mkdir -p /kvm/pools/homelab

    2. define the pool

      $ virsh pool-define-as --name default --type dir --target /kvm/pools/homelab

      Pool default defined

    3. set the pool to start at the same time as libvirtd

      $ virsh pool-autostart default

    4. start the pool

      virsh pool-start default

    Here you can create a pool with another name instead of default. To change the storage path of a existing pool, use the command:

    $ virsh pool-edit default

    Finally, observe the pool using virsh pool-list