Posted here for googlers and for my own future reference. Documentation pulled together from about 4 different sites. Could possibly be sub-titled: “Holy crap, the disk in my VMware installation is too small – it’s split up into 2GB files and using vmware to resize it seems like voodoo”
Problem:
My computer only has 20GB of disk space. I just have 1 partition. I want to add another disk (40GB). I don’t want to add another partition (and I really don’t want to reinstall the whole system), I want to increase the size of the root partition to 60GB. i.e. I want the root partition to span across two physical disks.
Solution:
- Add new physical disk. Boot.
-
# pvscanThis will show you the current physical volumes.
-
# fdisk /dev/sdbAdd the disk to your machine as a primary partition. Partition type: “
8e(LVM)”. Obviously/dev/sdbmay be different on your system. -
# pvcreate /dev/sdb1This creates a new physical LVM volume on our new disk.
-
# vgextend VolGroup00 /dev/sdb1Add our new physical volume to the volume group:
VolGroup00. Again, this group name may by different for you, but this is what Redhat & CentOS assigns by default when you install your system. -
# pvscanYou should see the new physical volume assigned to VolGroup00.
-
# lvextend -L+40G /dev/VolGroup00/LogVol00This increases the size of the logical volume our root partition resides in. Change the
-Lflag as appropriate.
We’ve just added 40GB to the logical volume used by the root partition. Sweet as. Now we need to resize the file system to utilize the additional space.
- Reboot into rescue mode using your CentOS CDROM.
From memory this involves typing
linux rescueas your boot option. - When prompted, skip the mounting of system partitions.
-
# lvm vgchange -a yThis command makes your LVM volumes accessible.
-
# e2fsck -f /dev/VolGroup00/LogVol00Run a file system check, the
-fflag seems necessary. No idea what we do if the returns an error? -
# resize2fs /dev/VolGroup00/LogVol00Without any parameters resize2fs will just increase the file system to the max space available.
REFERENCE
http://lucaschan.com/weblog/2007/06/29/adding-a-physical-disk-to-lvm-in-redhatcentos/
