「LVM」- PV CHANGED

  CREATED BY JENKINSBOT

#1 调整磁盘大小

How to Resize a Partition using fdisk

#2 调整LVM大小

当LVM的PV发生变化之后:

You can do this fairly simply. Kinda surprised there wasn’t an answer for this here already.

You can do this entire process while running on the filesystem you want to resize (yes, it’s safe and fully supported). There is no need for rescue CDs or alternate operating systems.

Resize the partition (again, you can do this with the system running). GParted is easy to use and supports resizing.
You can also use a lower level tool such as fdisk. But you’ll have to delete the partition and recreate it. Just make sure when doing so that the new partition starts at the exact same location.

Reboot. Since the partition table was modified on the running system, it won’t take effect until a reboot.

Run pvresize /dev/sdXY to have LVM pick up the new space.

Resize the logical volume with lvextend. If you want to use the whole thing, lvextend -r -l +100%FREE /dev/VGNAME/LVNAME. The -r will resize the filesystem as well.
Though I always recommend against using the entire volume group. You never know what you’ll need in the future. You can always expand later, you can’t shrink.

##

Expanding LVM Partitions in VMware, on the fly

参考文献

How do i extend a partition with a LVM and the contained physical volume and logical volume?