Use the pvdisplay and pvs commands to display the PVs you have created. The pvs command shows summarize output and the pvdisplay shows the detailed output of the PVs.
# lvdisplay /dev/vg01/lv001---Logicalvolume---LVPath/dev/vg01/lv001LVNamelv001VGNamevg01LVUUIDca307aa4-0866-49b1-8184-004025789e63LVWriteAccessread/writeLVCreationhost,timelocalhost.localdomain,2020-09-1011:43:05-0700LVStatusavailable# open 0LVSize10.00GiBCurrentLE2560Segments1AllocationinheritReadaheadsectorsauto-currentlysetto256Blockdevice253:4
How to Create Logical Volume Using PE Size’s
Alternatively, you can create Logical Volumes Using Physical Extends (PE) size.
How to Calculate PE Value? It’s very simple, for example, if you have a volume group of 10 GB, then what is the PE size?
By default, it uses 4MB for the physical extent, but check the correct PE size by running the vgdisplay command, as this can be changed based on requirements.
10GB=10240MB/4MB (PE Size) = 2560 PEs
Common syntax for Logical Volume Creation with PE Size’s (lvcreate).
lvcreate–n [Logical VolumeName]–l [Physical Extends (PE) Size] [Name of the Volume Group where the LV to be created]
To create 10GB of logical volume using the PE size the command would be:
Mounting Logical Volume Finally, you need to mount the logical volume to use it. Make sure to add an entry to /etc/fstab so that it loads automatically when the system boots.
Create a directory to mount the logical volume.
# mkdir /lvmtest
Use the mount command to mount the logical volume.
# mount /dev/vg01/lv001 /lvmtest
Add new logical volume details to the /etc/fstab file to mount automatically when the system starts.
# vi /etc/fstab/dev/vg01/lv001/lvmtestxfsdefaults00
Check the newly mounted volume using the df command.