Last Updated: 8/20/2024
The following command creates a logical volume that is 5 G in the volume group “vg1”
# lvcreate -L 5 G vg1
The following command displays the defined volume group. By default will list a long detailed list. You may need to use a little command line kungfu to pair this down to what you need.
root@nodey:/home/ubuntu# vgdisplay
--- Volume group ---
VG Name ubuntu-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <30.00 GiB
PE Size 4.00 MiB
Total PE 7679
Alloc PE / Size 3839 / <15.00 GiB
Free PE / Size 3840 / 15.00 GiB
VG UUID Fbt7VP-j779-42n8-jyam-s1py-8n22-CnLFHG
root@nodey:/home/ubuntu# vgdisplay ubuntu-vg| grep "Total PE"
Total PE 7679
Please note the use of grep with the -E parameter (extended regular expressions) This allows us to exercise additional control and bring order to the universe.
root@nodey:/home/ubuntu# vgdisplay ubuntu-vg| grep -E 'VG Name|Alloc PE|VG UUID'
VG Name ubuntu-vg
Alloc PE / Size 3839 / <15.00 GiB
VG UUID Fbt7VP-j779-42n8-jyam-s1py-8n22-CnLFHG
references:
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/5/html/logical_volume_manager_administration/lv#create_linear_volumes