KVM custom storage pool on LVM partition
Libvirtd by default has a storage pool called default, we can create additional storage pools from a simple XML file.
<pool type="logical">
<name>store</name>
<source>
<device path="/dev/sda1"/>
</source>
<target>
<path>/dev/store</path>
</target>
</pool>$ virsh pool-define store.xml
Pool store defined from store.xml
$ virsh pool-start store
Pool store started
$ virsh pool-list
Name State Autostart
-------------------------------------------
cipher active yes
default active no
store active no
$ virsh pool-autostart store
Pool store marked as autostarted
$ virsh pool-autostart default
Pool default marked as autostarted
$ virsh pool-list
Name State Autostart
-------------------------------------------
cipher active yes
default active yes
store active yes
$ virsh vol-create-as store linux2 25G
Vol linux2 created
$ virsh vol-list store
Name Path
------------------------------------------------------------------------------
linux1 /dev/store/linux1
linux2 /dev/store/linux2
$ lvdisplay /dev/store/linux2
--- Logical volume ---
LV Path /dev/store/linux2
LV Name linux2
VG Name store
LV Size 25.00 GiB
$ virt-install \
--name linux2 \
--ram 512 \
--disk path=/dev/store/linux2 \
--vcpus 2 \
--os-type linux \
--os-variant rhel7 \
--network network=default \
--graphics none \
--console pty,target_type=serial \
--location '/home/cipher/CentOS-7-x86_64-Minimal-1708.iso' \
--extra-args 'console=ttyS0,115200n8 serial'
$ virt-install \
--name linux2 \
--ram 512 \
--disk path=/dev/store/linux2 \
--vcpus 2 \
--os-type linux \
--os-variant rhel7 \
--network network=default \
--graphics none \
--console pty,target_type=serial \
--location '/home/cipher/CentOS-7-x86_64-Minimal-1708.iso' \
--initrd-inject '/var/www/html/pub/ks.cfg' \
--extra-args 'console=ttyS0,115200n8 serial' \
--extra-args 'ks=file:/ks.cfg' \
--accelerate
Related Articles
KVM custom storage pool on LVM partition
Libvirtd by default has a storage pool called default, we can create additional storage pools from a simple XML file.
Virt-sparsify
How to use virt-sparsify to reclaim unused disk space from qcow2 VM images.
Libvirt volume management
On libvirt default storage pool is created called default, default pool will be defined to use location /var/lib/libvirt/images for file based volumes.