This post describes one way of increasing a filesystem that is mounted on a logical volume inside a RHEL5 virtual machine.

This operation can be done on a live filesystem.

The first step is to add a new virtual disk to the virtual machine using VMware client for example.

Format the disk

Find the new device name (/dev/sdb in this case).

# echo "- - -" > /sys/class/scsi_host/host0/scan
# dmesg
# partprobe -s /dev/sdb

Use the entire disk and assign it the Id 8e (Linux LVM)

# fdisk /dev/sdb
# fdisk -l /dev/sdb
------------------------------ cut here ------------------------------
Disk /dev/sdb: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
  
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2088    16771828+  8e  Linux LVM
------------------------------ cut here ------------------------------

Initialize the partition for use by LVM

# pvcreate /dev/sdb1

Add the physical volume to the volume group

Find the Volume Group name that needs to be extended:

# vgdisplay | grep Name
------------------------------ cut here ------------------------------
  VG Name               VolGroup00
------------------------------ cut here ------------------------------

# vgextend VolGroup00 /dev/sdb1

Extend the size of the logical volume

Find the Logical Volume name that needs to be extended:

# lvdisplay | grep Name
------------------------------ cut here ------------------------------
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
------------------------------ cut here ------------------------------

# lvextend -l +100%FREE /dev/mapper/VolGroup00-LogVol00

Resize the filesystem

# resize2fs /dev/mapper/VolGroup00-LogVol00