How to Resize LVM Partition in Linux

Last updated: July 1, 2022

Using an LVM partition gives you flexibility in using storage disk space. This allows users to create partitions from more than one disk and allows them to extend the filesystem size online within a few seconds.

In this guide, we learn how to resize an LVM partition in Linux.

Resize LVM

Resize LVM is required when you have low storage space. This could be your root or home directory filesystem partition. Here we cover the following:

  • Extend LVM using an existing disk using lvextend.
  • Extend storage with a new disk using lvextend.
  • Shrink LVM volume using lvreduce

Extend LVM using an existing disk

In this scenario, we have an unused partition on existing storage and we want to use it to extend another LVM partition.

a. Check volume groups details

First, we will use vgdisplay command to see the detail of our Volume Groups (next we call it VG).

# vgdisplay
Show volume group detail

We can see that there is 49.21 GB Free Size.

To see the more detail of our VG, we can use add -v parameter to vgdisplay command.

# vgdisplay -v
VG more detail

b. Extend storage

The /dev/vg_devmachine/data has 24.41 GB. Let say we want to add 10 GB more to /data partition. To extend a logical volume you simply tell the lvextend command how much you want to increase the size (+10 below) with -L parameter.

# lvextend -L+10G /dev/vg_devmachine/data
Extend LVM

Note for RHEL 3 Only: We need to unmount the partition before activate the change.

# unmount /dev/VolGroup00/LogVol00

For this example, we can unmount /data partition by typing:

# unmount /dev/vg_devmachine/data

Then we need to activate the change. We will use resize2fs command. This command is used to resize ext2/ext3/ext4 file system online.

# resize2fs /dev/vg_devmachine/data

Note: On RHEL 4 you can use ext2online command to resize the partition.

# ext2online /dev/mapper/vg_devmachine-data

But on RHEL 5 above, the command is replaced by resize2fs command.

Now to check it, run vgdisplay -v again, and highlight the /dev/vg_devmachine/data.

New VG display after extend

We now see that the LV size grow into 34.41 GB.

If you are using RHEL 3, don't forget to mount your partition again.

Extend storage with a new disk

In this scenario, we have added new storage which is /dev/sdb with 100 GB capacity into Linux system. Then, we want to use it to extend existing LVM partition. The command to extend LVM partition to another disk remains the same. But when we add more physical storage into the system, then we need to make the OS (Linux) know more about it.

a. Create a physical partition

When we add a new disk, we need it to be recognized by the system to make some operations.  There are some partition tools on the internet such as fdisk and parted. In this guide, we will use fdisk because it is available in most Linux Distributions. The first thing to do is to create a new partition.

If you need the entire disk /dev/sdb, doesn't really need to partition the disks.

# fdisk /dev/sdb
Create new partition

Press n to create new partition.

Let us say, we want to create 2 new partitions. Press p and 1 to create new primary partition. Put the size as 50G.

Repeat the operation for the second partition. press p and 2 to create the second primary partition. For the size (at question Last cylinder ...), you don't need to enter a value, it will consider the rest of space as the example below

Specify the size

Once it is finished, commit the change by pressing w button.

Now if we do fdisk -l, we will see /dev/sdb1 and /dev/sdb2 partition appear.

New partition appear

b. Create Physical Volume (PV) as the base of LVM

After we finish creating the physical partition, the next step is to create Physical Volume (PV). PV is used as the host of LVM. A physical disk is divided into one or more physical volumes (PV)

# pvcreate /dev/sdb1 /dev/sdb2
Create PV

If you find no error, you can check the result using pvscan command.

# pvscan
Scan available PV

We now see two empty PV appear. Empty means that the PV’s does not belong to any Volume Group.

c. Extend the Volume Group (VG)

Logical volume groups (VG) are created by combining one or more PV. We have already a VG called vg_devmachine. Its capacity is 95.11 GB and 39.21 GB of free space. To extend vg_devmachine, we can use vgextend command.

# vgextend vg_devmachine /dev/sdb1
Extend Volume Group

Check it via vgdisplay. You will see that vg_devmachine size is increasing.

d. Extend the LVM partition

Now in this stage, we will use the same command at the previous one. Let's say we want to extend /home partition. Adding it more 30 GB.

Again we check it using lvdisplay command first to see the current capacity.

# lvdisplay
Display LV for /home

To add more 30G into /home partition, we need to extend the partition:

# lvextend -L+30G /dev/vg_devmachine/home
Extend /home partition

Then we need to activate the change so it will take effect:

# resize2fs /dev/vg_devmachine/home
Activate the change using resize2fs


When your current partition is running out of space, you can easily resize the partition on-the-fly. You notice that we didn't need to unmount the partition to extend LVM and unmount is only required when you need to shrink the LVM.

One disadvantage is if the physical disk has a problem, it will affect the volume groups and all the LVM partitions created.

About The Author

Bobbin Zachariah

Bobbin Zachariah

Bobbin started his career in IT in the year 2000 as a computer science instructor and worked as a Linux system engineer and senior analyst roles. Currently working in DevOps environments to increase efficiency and improve delivery time in AWS Cloud infrastructure. He is certified in RHEL, CCNA, and MCP and holds a Masters's in computer science. When in his free time love playing cricket, blogging, and listening to music.



Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment