Linux LVM Management

The LVM stands for logical volume management. LVM is an abstraction layer between our operating system and physical hard drives. This means the physical hard drives and partitions are no longer tied to the hard drives and partitions they reside on. The hard drives and partitions that your operating system views can be any number of separate hard drives pooled together. Graphic User Interface (GUI) tools are readily available to manage Logical Volume Management (LVM). In order to really understand what is happening with our LVM configuration, it is probably the best idea to utilize the command line. This will be especially useful if you are managing a LVM on a server that does not offer GUI tools. Most of the LVM commands are very similar to each other. That commands are specified below:

1) Physical Volume -Pv

2) Volume Group -Vg

3) Logical Volume- lv

The physical volume commands add or remove hard drives in volume groups. Logical volume commands will present the volume groups as partitions so that our operating system can take it as designated space.



Logical volume management is a powerful mechanism for managing storage space. Once a normal partition is created, we can’t resize the existing partition, but in the case of LVM it is possible to resize the partitions. If we need to create a separate partition for any purpose or need to expand the size of an existing partition, we can reduce the large partition and expand the low space partition very easily with LVM.


How to Extend Volume Group and Reduce Logical Volume

We can check existing Pv (physical volume), Vg (volume group) and Lv (logical volume) partitions through the following commands:

# pvdisplay (to display physical volume size)

# vgdisplay (to display volume group size)

# lvdisplay (to display logical volume size)

If there is no free space available in Physical Volume and Volume group. We cannot increase the LVM size, for extending we need to add another physical volume (PV). Then we have to increase the volume group by extending the VG (volume group). We will get adequate space to extend the Logical volume size. The logical volume resizing is dependent on the volume group (VG) and physical volume (pv).


Extending Logical volume

To extend a logical volume first we check that enough memory is available on the volume group. In case there is no free space in the volume group we should increase the volume group size of physical memory.

# lvextend -L 10G /dev/vgname/lvname

lvextend — extending logical volume “/dev/myvg/mylv” to 10 GB

lvextend — doing automatic backup of volume group “myvg”

lvextend — logical volume “/dev/myvg/” successfully extended

vg name – myvg

lvname – mylv

In this case 10GB space is added to the logical volume. Here we have another option to add memory on top of the existing memory

# lvextend -L+1G /dev/myvg/mylv

lvextend — extending logical volume “/dev/myvg/mylv” to 11 GB

lvextend — doing automatic backup of volume group “myvg”

lvextend –logical volume “/dev/myvg/mylv” successfully extended

In this case added 1GB to the existing LVM (/dev/myvg/mylv) partition. After extending the logical volume it is necessary to extend the file system size to match. It depends on the file system you are using. By default, the file system resizing tools will extend the size of the current file system to be the size of the logical volume so we don’t need to worry about specifying the size for each of the two commands.


Extend file system size

1) ext2/ext3

If we use ext2/ext3 file system for LVM mounting, use the following commands to resize the file system.

# umount /dev/myvg/mylv/dev/myvg/mylv

# resize2fs /dev/myvg/mylv

# mount /dev/myvg/mylv /home

/home – mount point

2) reiserfs

reiserfs file system can be resized with following commands:

# umount /dev/myvg/mylv

# resize_reiserfs /dev/myvg/mylv

# mount -treiserfs /dev/myvg/mylv /home

/home à mount point

3) xfs

XFS file systems must be mounted to be resized and the mount-point is specified rather than the device name.

 # xfs_growfs /home

/home à mount point

4) jfs

Just like XFS the jfs file system must be mounted to be resized and the mount point should be specified rather than the device name.

# mount -o remount,resize /home.

/home à mount point

Finally, we can check the partition size through the pvdisplay, vgdisplay and lvdisplay commands.


If you need any further assistance please contact our support department.