When we use LVM (Logical Volume Manager) for disk management, if we need to expand the physical volume (PV) of a single disk partition, we can follow the following steps:
- Check the current disk partition situation : First, use
pvdisplay
the command orpvs
command to view the physical volume information in the current system and confirm the name of the disk partition to be expanded (for example/dev/sdb1
). - Expand disk partition : Use appropriate tools (such as
fdisk
) to expand the partition size of the target disk. The specific steps may vary, but generally include opening the disk partitioning tool, selecting the target disk, modifying the partition size, saving changes, etc. Make sure the partition is resized to the desired size and save the changes. - Rescan disk partitions : Run
partprobe
a command or restart the system to rescan disk partitions and identify changes in partition size. -
Extend physical volume : Run
pvresize
the command to extend the size of the physical volume. For example, extend/dev/sdb1
a physical volume with the following command:pvresize /dev/sdb1
This will bring the physical volume size into line with the expanded disk partition size.
- Verify expansion : Run
pvdisplay
the command orpvs
command to confirm that the size of the physical volume has been expanded to the target size.
After completing the above steps, the expansion of the physical volume is completed. Next, you can continue to expand the logical volume (LV) or other operations to adapt to the larger physical volume space.
It should be noted that disk partition expansion and physical volume expansion may involve restarting the system or rescanning disk partitions, so before operating, please make sure to back up important data and proceed with caution.
In summary, to expand the physical volume of a single disk partition in LVM, first extend the size of the disk partition, then rescan the disk partition and use the command to pvresize
extend the size of the physical volume. After completing these steps, the physical volume will be successfully expanded.