By default, libvirt-based commands use the directory /var/lib/libvirt/images on a virtualization host as an initial file system directory storage pool. You can easily create a new storage pool by using the virsh pool-create-as command.
As we discussed during the LAB setup – I have a disk /dev/sdb (40G) which we will use storage pool. I will be create a LVM VG with name ‘lab_kvm_storage ‘ and LV with name ‘lab_kvm_lv’ then creating a xfs filesystem on the LV.
vgcreate lab_kvm_storage /dev/sdb
lvcreate -l +100%FREE -n lab_kvm_lv lab_kvm_storage
mkfs.xfs /dev/mapper/lab_kvm_storage-lab_kvm_lv
Off course we will add the fstab entry for auto-mount on every system boot.
/dev/mapper/lab_kvm_storage-lab_kvm_lv /var/lib/libvirt/images xfs defaults 0 0
Mount the /var/lib/libvirt/images as a new filesystem
mount –a
Now let’s create a storage pool and start it. Also we will enable auto-start so pool will be available e on every system boot.
virsh pool-define-as lab_kvm_storagepool --type dir --target /var/lib/libvirt/images
virsh pool-autostart lab_kvm_storagepool
virsh pool-start lab_kvm_storagepool
virsh pool-list
To see detailed information about a pool , you can run the below command.
virsh pool-list --all –-details
With this steps – we have Storage Pool Ready
Watch the video for details: