Step-by-Step Guide to Expanding a Linux Server’s Root Partition with LVM
This article walks through expanding a Linux server’s root filesystem by checking disk usage, adding a new disk, creating a physical volume, extending the volume group and logical volume, and resizing the XFS filesystem, with commands and screenshots for each step.
This guide explains how to expand the root partition of a Linux server using LVM tools.
First, check the current disk usage with df -hl and list all disks with fdisk -l.
Partition the newly added disk using fdisk /dev/sdb and follow the interactive prompts.
Create a physical volume on the new partition with pvcreate /dev/sdb1, then verify it using pvdisplay.
Extend the existing volume group named centos by adding the new physical volume: vgextend centos /dev/sdb1. Check the free space in the volume group with vgdisplay.
Increase the size of the root logical volume using lvextend -L +60G /dev/mapper/centos-root.
Resize the XFS filesystem to occupy the enlarged logical volume with xfs_growfs /dev/mapper/centos-root.
Finally, run df -hl again to confirm that the root partition has grown; the screenshot shows the increased size in the highlighted area, indicating a successful expansion.
Linux Tech Enthusiast
Focused on sharing practical Linux technology content, covering Linux fundamentals, applications, tools, as well as databases, operating systems, network security, and other technical knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
