[CentOS] Resizing a PV that belongs within a Volume Group?

Alexander Dalloz ad+lists at uni-x.org
Fri Feb 19 11:23:31 UTC 2010


> Hi,
>
> I was wondering if there was a way to extend (ie: grow) a PV that is part
> of
> a Volume Group?  I currently have a partition on my HD that is being used
> as
> a PV for my Volume Group, but would like to make it larger.  I have the
> space on my drive to extend my partition, but using standard tools (ex:
> gparted, Partition Magic, etc) would likely end up corrupting the data on
> in
> the Logical Volumes that are housed within the VG.

[ ... ]

> I tried looking at tools like pvresize but I can't seem to understand the
> right arguments to use it as whatever I try never seems to resize the
> original partition itself.  I also looked at system-config-lvm GUI tool,
> but
> that doesn't seem to allow me to make the PV any larger.
>
> Does anyone have any suggestions?
>
> Thanks!
>
> Eric

Given the partition which is a physical volume can be enlarged because
there is free space directly after the end of the current partition, you
then can do following very easily:

1) fdisk /dev/<device>
1a) delete the partition to enlarge
1b) re-create the partition from the same starting point to the new size
1c) save the changes

2) partprobe /dev/<device>
   to let the kernel know about the change

3) pvresize /dev/<deviceNUM>
   increases the PV to maximum partition size (just as the manpage says)

4) pvdisplay /dev/<deviceNUM>
   should show you now free physical extends (vgdisplay as well)

5) lvresize -L +100%FREE /dev/mapper/<LVM-volume>
   expands the volume to use all free extends
   or split up the additional size to several volumes

6) resize2fs /dev/mapper/<LVM-volume>
   to let the filesystem know about the additional space

Regards

Alexander




More information about the CentOS mailing list