Linux LVM configurations are now standard in the current Red Hat and CentOS enterprise products. This article shows you how to add capacity to a volume group and then resize a logical partition on the fly.
Step 1 add a new disk to the VM, then :
[root@tsipouro ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
Step 2 add the disk to the Volume Group
[root@tsipouro ]# vgextend VolGroup00 /dev/sdb
Volume group "VolGroup00" successfully extended
Step 3 extend the filesystem:
[root@tsipouro ]# lvextend -L +20G /dev/VolGroup00/ftp
Extending logical volume ftp to 31.50 GB
Logical volume ftp successfully resized
NOTE: its not shown in df yet...
[root@tsipouro ]# df \-h
Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6.0G 3.5G 2.2G 62% /
/dev/sda1 190M 19M 162M 11% /boot
tmpfs 506M 506M 0% /dev/shm
/dev/mapper/VolGroup00-ftp 9.9G 9.4G 0 100% /var/ftp
Step 4 resize the filesystem ( then its visible from the OS )
[root@tsipouro ]# resize2fs /dev/VolGroup00/ftp
resize2fs 1.41.0 (10-Jul-2008)
Filesystem at /dev/VolGroup00/ftp is mounted on /var/ftp; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/VolGroup00/ftp to 8257536 (4k) blocks.
The filesystem on /dev/VolGroup00/ftp is now 8257536 blocks long.
Output
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
6.0G 3.5G 2.2G 62% /
/dev/sda1 190M 19M 162M 11% /boot
tmpfs 506M 0 506M 0% /dev/shm
/dev/mapper/VolGroup00-ftp
32G 9.4G 21G 32% /var/ftp





