Extending a Logical Volume

Situation a: Have enough free space on group volume vg00

check current size Logical Volume “lv00″

 # df -h
Filesystem                          Size  Used Avail Use% Mounted on
/dev/mapper/vg00-lvrooC5
                                           19G  2,5G   16G  14% /
/dev/sda1                            244M   28M  203M  12% /boot
tmpfs                                  3,8G     0  3,8G   0% /dev/shm
/dev/mapper/vg00-lv00
                                          9,9G  151M  9,2G   2% /mnt

extend logical volume

# lvextend -L +5G /dev/vg00/lv00
  Extending logical volume lv00 to 15,00 GB
  Logical volume lv00 successfully resized

check size

 # df -h
Filesystem                          Size  Used Avail Use% Mounted on
/dev/mapper/vg00-lvrooC5
19G  2,5G   16G  14% /
/dev/sda1                            244M   28M  203M  12% /boot
tmpfs                                  3,8G     0  3,8G   0% /dev/shm
/dev/mapper/vg00-lv00
                                          9,9G  151M  9,2G   2% /mnt

size does not change because we need further resize the File System

# resize2fs /dev/vg00/lv00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vg00/lv00 is mounted on /mnt; on-line resizing required
Performing an on-line resize of /dev/vg00/lv00 to 3932160 (4k) blocks.
The filesystem on /dev/vg00/lv00 is now 3932160 blocks long.

check new size

# df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/vg00-lvrooC5
                                       19G  2,5G   16G  14% /
/dev/sda1                         244M   28M  203M  12% /boot
tmpfs                               3,8G     0  3,8G   0% /dev/shm
/dev/mapper/vg00-lv00
                                       15G  154M   14G   2% /mnt

Situation b: Not have enough free space on group volume vg00

First, have to extend the volume group “vg00″
check current size “vg00″

# vgdisplay vg00 | grep “VG Size”
  VG Size               185,81 GB

create physical volume on another disk partition (/dev/sdc5)

# pvcreate /dev/sdc5
  Writing physical volume data to disk “/dev/sdc5″
  Physical volume “/dev/sdc5″ successfully created

then extend the volume group

# vgextend vg00 /dev/sdc5
  Volume group “vg00″ successfully extended

Finally check the new size

# vgdisplay vg00 | grep “VG Size”
  VG Size               465,25 GB

and now we are in the situation a