(Last Updated On: June 13, 2017)

Extend root filesystem using LVM on Linux. This will cover both ext4 and xfs filesystem root partition extending.  It will start by creating a new partition and then partitioning it and adding it to physical volume.

Step 1: Confirm Disk Partitions in Distribution.

You can do this by typing

df –h

Step 2: Format data disk as LVM partition

First become root by typing

sudo su –

Format disk partition by typing

fdisk /dev/xvda

Note: Device name differs for different distributions check by listing them with fdisk –l it is xvda in our case

To list options available

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

List LVM partitions present

Command (m for help): p
Disk /dev/xvda: 1099.5 GB, 1099511627776 bytes
255 heads, 63 sectors/track, 133674 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000403ec
Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2              64        2611    20458496   8e  Linux LVM

To add the data disk to partition table

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 3
First cylinder (2611-133674, default 2611):
Using default value 2611
Last cylinder, +cylinders or +size{K,M,G} (2611-133674, default 133674):
Using default value 133674

Confirm that this has been done by typing p again

command (m for help): p

To convert its system type to LVM

command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Confirm the changes

command (m for help): p

Write changes to disk

command (m for help): w

Reboot the VM at this point to save changes before going to the next step.

Step 3: Create Physical Volume

Check physical volumes present in distribution by typing


Resize Volume Group

pvcreate     /dev/xvda3

Confirm that the volume has been converted successfully


Step 4: Add the New Physical Volume to Volume Group

Check volume group already present


Add volume to volume group

vgextend /dev/name-of-volume-group     /dev/xvda3

Confirm this using first command

Step 5: Resize root logical volume to occupy all space

Confirm name of root logical volume using lsblk command, some distributions name it as lv_root, we used root in this guide.

Resize root

lvextend -l 100%FREE /dev/name-of-volume-group/root

Confirm using


You can replace the 100%FREE command with preferred space in MB, for example, to add 256 MB replace it with +256M

Step 6: Copy changes to filesystem

df -h

still shows 19G for the root volume; to make the filesystem report the actual size use

For ext4 filesystem

resize2fs /dev/name-of-volume-group/root

For xfs filesystem

xfs_growfs /dev/name-of-volume-group/root


You have learned how to extend root filesystem backed by nfs and ext4 with this how to extend root filesystem using LVM guide. I hope this was helpful and would like to thank you for reading.

Similar Articles:

How to create disk partitions in Windows using diskpart command

Running Zenoss on iSCSI and LVM remote Storage

Arch Linux Installation Cheatsheet With LUKS Encryption

Working with qemu-img in Linux

Understanding and Working With BtrFS Filesystem in Linux

Install Arch Linux with LVM on UEFI system