Before a hard drive or partition can be used in an LVM system it needs to be initialised. These physical volumes (PVs) can be created with pvcreate, and allows us to create Volume Groups.
Creating a physical volume is the first step in preparing a drive or partition for use in a Linux LVM setup. Once created, we can use pvdisplay to get information about the volume or pvs to get a summary of all initialised PVs.
Example
To create a new physical volume and then see data about it:
pvcreate /dev/sdX>> Phyisical volume "/dev/sdX" successfully createdpvdisplay /dev/sdX>>--- Physical volume --->>PV Name /dev/sdX>>VG Name <not assigned>>>...etc
Once a physical volume is created, it can be included in a volume group
pvdisplay
pvdisplay will show us information such as size, UUID, and whether it belongs to a VG.
pvs
This gives us general information with multiple columns that describe the existing physical volumes in the system:
PV
VG
Fmt
Attr
PSize
PFree
/dev/sdX
vg01
lvm2
a--
200.00G
50.00G
pvscan
Used when adding new storage or to re scan existing PVs. This is used when you suspect disks aren’t being recognised in order to begin troubleshooting.
Physical volume modification
With Linux LVM physical volumes can be modified to move data around them, resize the storage pools, or remove the volumes when no longer needed.
pvresize
pvmove
pvremove
When removing a physical volume from LVM, the PV must first be removed from any Volume Group it belongs to.