How to extend the root partition in LVM

In this tutorial, I am using the CentOS6(but also applicable on other Linux distro) that has ext4 partition lv_root mounted as / and lv_swap as swap from the volume group vg_centos6 (which is default), we pretend that we are running out of space in lv_root(/) and volume group (vg_centos6) doesn’t have any free space. We added a brand new drive with 20 GB space. Now, we need to assign this 20 GB space to volume group and then extend lv_root(/).

WARNING: Backup your data before attempting this.

First, we’ll check the file system disk space usage and logical volume information:

sudo df -h
sudo lvs


Get the information about newly added hard disk using the following command:

sudo fdisk -l

2Note/dev/sdb is the newly added hard disk!

To create the partition on the second Hard disk, use the following command and follow the “on screen” instructions and change the partition type from Linux to LVM (8e):

sudo fdisk /dev/sdb


Identify the already mounted lvm file system type:

df -T


Format the newly created partition using the following command:

sudo mkfs.ext4 /dev/sdb1


Initialize the newly created partition as a physical volume:

sudo pvcreate /dev/sdb1


Check the volume groups using the following command:

sudo vgs

7Note: vg_centos6 is the volume group that I want to extend, you can change according to your volume group.

Extend the VG (vg_centos6) with new PV (/dev/sdb1):

sudo vgextend vg_centos6 /dev/sdb1


Extend the logical volume (lv_root) with all the free space of the VG(vg_centos6):

sudo lvextend -l +100%FREE /dev/vg_centos6/lv_root


Finally, resize the file-system:

sudo resize2fs /dev/vg_centos6/lv_root


Verify the file-system is larger using the following commands:

sudo df -h
sudo lvs
sudo vgs


Hope this will help you!

Please Remember me in your prayers!

10 responses to “How to extend the root partition in LVM

  1. Pingback: nothingOS » Resize or add new LVM partition/disk on Centos

  2. Pingback: Resize root volume on LVM (centos) | I'm Mr Uolf, I solve problems

  3. Minthang Sitlhou December 15, 2015 at 5:31 am

    This tutorial works.


  4. Pingback: Expand Ubuntu LVM - Charles' Blog

  5. Jon Brookes February 3, 2017 at 2:54 pm

    Well written, simple easy to follow. Works.

    Thanks for this.

  6. Deshmukh July 2, 2017 at 9:42 pm


  7. Michel Langras July 13, 2017 at 4:54 pm

    Thanks! Works and easy to follow!

  8. aaryadewa August 30, 2017 at 1:19 pm

    Followed this steps on my Fedora 26 and worked. Many thanks

  9. Tomasz Wieczorek September 17, 2017 at 7:00 pm

    Very good written tutorial. This is works good.
    Thanks 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: