With standard partition layout we can have maximum 4 primary partitions (considering MBR). With LVM we can create number of partitions. A partition has to be initialized and volume group has to be created for making LVM partitions on top of it.
$ pvcreate /dev/sda1
WARNING: ext4 signature detected on /dev/sda1 at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sda1.
Physical volume "/dev/sda1" successfully created.
$ vgcreate store /dev/sda1
$ pvdisplay
--- Physical volume ---
PV Name /dev/sda1
VG Name store
PV Size 596.17 GiB
Allocatable yes
PE Size 4.00 MiB
Total PE 152619
Free PE 152619
Allocated PE 0
$ vgdisplay
--- Volume group ---
VG Name store
Format lvm2
VG Size 596.17 GiB
PE Size 4.00 MiB
Total PE 152619
Alloc PE / Size 0 / 0
Free PE / Size 152619 / 596.17 GiB
Create an XML file for the pool:
<pool type="logical">
<name>store</name>
<source>
<device path="/dev/sda1"/>
</source>
<target>
<path>/dev/store</path>
</target>
</pool>Define and start the pool:
$ virsh pool-define store.xml
Pool store defined from store.xml
$ virsh pool-start store
Pool store started
$ virsh pool-autostart store
Pool store marked as autostarted
$ virsh pool-list
Name State Autostart
-------------------------------------------
cipher active yes
default active yes
store active yes
$ virt-install --name linux1 --ram 1024 --disk path=/dev/store/linux1 --vcpus 2 --os-type linux --os-variant rhel7 --graphics none --console pty,target_type=serial --location '/home/cipher/CentOS-7-x86_64-Minimal-1708.iso' --extra-args 'console=ttyS0,115200n8 serial'
Related Articles
LVM disk management on fedora 26
With standard partition layout we can have maximum 4 primary partitions (considering MBR). With LVM we can create number of partitions.
Virt-sparsify
How to use virt-sparsify to reclaim unused disk space from qcow2 VM images.
Renaming lv and vg
How to rename Logical Volumes (LV) and Volume Groups (VG) in LVM on Linux.