Extending a logical volume


Logical volume can be extended on the fly without any downtime

Step 1:

List the logical volume and check the current size. Here i am going to extend the LV01 to 30G by adding 5Gb to the current size 25GB

[root@server1 ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
LV01 VG01 -wi-ao—- 25.00g
LV02 VG01 -wi-a—– 40.00m

The logical volume LV01 is mounted and we are going to extend it online

[root@server1 ~]# df -h /mount_point/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG01-LV01 25G 45M 24G 1% /mount_point

 

Step 2:

Extending the logical volume LV01 by 5GB

[root@server1 ~]# lvextend -L +5G /dev/mapper/VG01-LV01
Extending logical volume LV01 to 30.00 GiB
Logical volume LV01 successfully resized

 

Step 3:

Updated the partition table.
Current the logical volume(LV01) is extending by 5GB but is is not reflected in the filesystem
Below mount point showing the original size of 25Gb

[root@server1 ~]# df -h /mount_point/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG01-LV01 25G 45M 24G 1% /mount_point

Update the partition table by re-sizing the filesystem

[root@server1 ~]# resize2fs /dev/mapper/VG01-LV01
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mapper/VG01-LV01 is mounted on /mount_point; on-line resizing required
old_desc_blocks = 4, new_desc_blocks = 4
The filesystem on /dev/mapper/VG01-LV01 is now 7864320 blocks long.

 

Step 4:

Verify the mount point size
Now the mount point has been increased to 30GB

[root@server1 ~]# df -h /mount_point/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG01-LV01 30G 45M 28G 1% /mount_point