Operations 5 min read

How to Expand a Linux Root Partition with LVM in Minutes

Learn step‑by‑step how to enlarge a Linux root filesystem using LVM commands—checking disk usage, creating a physical volume, extending the volume group and logical volume, and resizing the XFS filesystem—complete with command examples and verification screenshots.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Expand a Linux Root Partition with LVM in Minutes

Overview

This guide shows how to enlarge the root ( /) filesystem on a CentOS system that uses LVM with an XFS filesystem. The procedure adds a new physical disk, incorporates it into the existing volume group, expands the logical volume that holds the root filesystem, and finally grows the XFS filesystem to use the added space.

Prerequisites

Root or sudo access on the target server.

A spare block device (e.g., /dev/sdb) that is not currently used.

Basic familiarity with LVM commands ( pvcreate, vgextend, lvextend) and XFS tools ( xfs_growfs).

Step‑by‑step procedure

1. Inspect current storage layout

Display the size and mount points of all filesystems: df -h List all block devices and their partitions to locate the new disk:

fdisk -l

2. Partition the new disk

Use fdisk (or gdisk) to create a single Linux LVM partition on the new device. Example for /dev/sdb: fdisk /dev/sdb Typical actions inside fdisk:

Press n to create a new partition.

Accept the default partition number and size (use the whole disk).

Press t then 8e to set the partition type to “Linux LVM”.

Press w to write the table and exit.

3. Create a physical volume (PV)

Initialize the new partition as an LVM physical volume: pvcreate /dev/sdb1 Verify that the PV was created correctly:

pvdisplay /dev/sdb1

4. Extend the volume group (VG)

Add the new PV to the existing volume group (the default name on CentOS is centos): vgextend centos /dev/sdb1 Check the free extents now available in the VG:

vgdisplay centos

5. Grow the logical volume (LV) that holds the root filesystem

Identify the LV path (commonly /dev/mapper/centos-root or /dev/centos/root). Extend it by the desired amount, e.g., 60 GB: lvextend -L +60G /dev/mapper/centos-root Alternatively, use -r to automatically resize the filesystem after the LV is grown:

lvextend -r -L +60G /dev/mapper/centos-root

6. Resize the XFS filesystem

If the LV was extended without the -r flag, grow the XFS filesystem explicitly:

xfs_growfs /dev/mapper/centos-root

7. Verify the expansion

Show the updated filesystem sizes to confirm that the root partition now reflects the added space:

df -h

The output should display a larger size for /dev/mapper/centos-root, indicating that the expansion succeeded.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxLVMDisk ExpansionXFSRoot Partition
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.