How to Expand an LVM Partition on CentOS 7 in Production
This guide walks you through checking current disk usage, adding a new disk, creating an LVM partition, extending the volume group and logical volume, resizing the filesystem, and verifying the expansion on a CentOS 7 system to resolve disk‑space shortages.
Background
Production environments often encounter insufficient disk space; the following steps show how to extend an LVM‑based /home partition on CentOS 7.
Check current disk usage
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 200M 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 10G lvm /
├─centos-swap 253:1 0 4G lvm [SWAP]
└─centos-home 253:2 0 5G lvm /home
sr0 11:0 0 4.2G 0 romAdd new disk and create LVM partition
# fdisk /dev/sdb
... (create a new primary partition /dev/sdb1 of 5G, type 8e for Linux LVM) ...
# w (write changes)Initialize physical volume
# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.Extend volume group
# vgextend centos /dev/sdb1
Volume group "centos" successfully extendedResize logical volume
# lvresize -L +4G /dev/centos/home
Size of logical volume centos/home changed from 5.00 GiB (1280 extents) to 9.00 GiB (2304 extents).
Logical volume centos/home successfully resized.Resize filesystem
If the filesystem is XFS, run: # xfs_growfs /dev/centos/home If it is ext4, run:
# resize2fs /dev/centos/homeVerify the expansion
# lsblk
... shows /dev/mapper/centos-home now 9G ...
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 10G 927M 9.1G 10% /
/dev/mapper/centos-home 9G 33M 9G 1% /home
...After these steps the /home partition has grown from 5 GiB to 9 GiB, completing the disk‑space expansion.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.)
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.
