To display the LVM physical volume on a system, you can use either the pvs command or the pvscan command as the root user. The output of sudo pvscan is shown in the following screenshot:
To implement LVMs, we create three objects:
- Physical volumes: This represents the raw disk space as disk partitions. When we use partitions, the partition type should be set to Linux LVM with an ID of 8E using the fdisk partitioning tool.
- Volume groups: This aggregates physical volumes together so that the disk space can be consumed to logical volumes.
- Logical volumes: This represents the block device that can be shared. It consumes space that is allocated from volume groups.
pvscan Command Examples
1. To scan all disks for physical volumes:
2. To Only show physical volumes belonging to exported volume groups:
# pvscan -e # pvscan --exported
3. To only show physical volumes not belonging to any volume group:
# pvscan -n # pvscan --novolumegroup
4. To short listing format:
# pvscan -s # pvscan --short
5. To Show UUIDs in addition to device special names:
# pvscan -u # pvscan --uuid
6. To set to verbose mode:
# pvscan -v # pvscan --verbose
7. To get the pvscan version:
# pvscan --version