[CentOS] Increasing existing partition and LVM size

Theo Band theo.band at xanadu-wireless.com
Tue Feb 6 18:03:54 UTC 2007


Alfred von Campe wrote:
> I have a disk on which CentOS is installed and running.  The disk 
> partitions look like this:
>
> Disk /dev/sda: 42.9 GB, 42949672960 bytes
> 255 heads, 63 sectors/track, 5221 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sda1   *           1          13      104391   83  Linux
> /dev/sda2              14        1044     8281507+  8e  Linux LVM
>
> What I would like to do is increase the size of the second partition 
> to be the entire disk, and then grow the logical volume(s) and the 
> file systems on it.  BTW, this is all on a VMware virtual disk, so I 
> really can't screw things up, as I have a copy of the VMDK files and 
> can start over again (and again, and again...).  The disk was 
> originally 8GB, and I just resized it with vmware-vdiskmanager.
>
> I have tried to use parted to resize the partition, but I get the 
> message "Error: Could not detect file system.", and I can't find a way 
> to resize the partition with fdisk and sfdisk.  Am I missing something 
> obvious or is this not doable?

I would just create an additional partition /dev/sda3 with the free 
space. This partition can be added to the PVS:

pvcreate /dev/sda3
vgextend VolGroup00 /dev/sda3
lvextend -L20G /dev/VolGroup00/diskname
resize2fs      /dev/VolGroup00/diskname 20G

Depends of course on how your volume group is named. See the man pages 
for details.

Don't mess with the LVM partition using parted, but you figured that one 
out yourself :-)

Theo

PS.
If booted from a rescue disk,
use lvscan to find the LVM group.
Then activate the volume group by
vgchange -a y



More information about the CentOS mailing list