How to Expand Linux Disk Space with LVM: Step‑by‑Step Guide
Learn how to add a new disk, create partitions, adjust partition types, extend physical and logical volumes, and resize the filesystem on a Linux server using fdisk, LVM commands, and xfs_growfs, ensuring the system recognizes the expanded storage without data loss.
Linux Disk Expansion
After attaching a new disk in the console, restart the system and begin partitioning.
Add Partition
# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Command (m for help): n
Partition type: p (primary)
First sector: 41943040
Last sector: 83886079
Created partition 4 of type Linux, size 20 GiB.
Command (m for help): w
The partition table has been altered!
WARNING: Re‑reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at the next reboot or after running partprobe(8) or kpartx(8).Verify New Partition Types
# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectors
...
/dev/sda4 41943040 83886079 20971520 83 LinuxChange Partition Type to LVM
Because /dev/sdb3 has ID 8e (Linux LVM), change /dev/sda4 to the same ID.
# fdisk /dev/sda
Command (m for help): t
Partition number (1-4, default 4): 4
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
WARNING: Re‑reading the partition table failed with error 16: Device or resource busy.Verify Modified Partition Types
# fdisk -l
...
/dev/sda4 41943040 83886079 20971520 8e Linux LVMDisk Expansion
After reboot, extend the volume group and logical volume.
Check Volume Group
# lvs
LV VG Attr LSize
root centos -wi-ao---- <18.00g
swap centos -wi-ao---- 1.00g
# vgdisplay
VG Name centos
VG Size <19.00 GiB
...Extend Logical Volume
Create Physical Volume
# pvcreate /dev/sda4
Physical volume "/dev/sda4" successfully created.If you see "Device /dev/sda4 not found", run partprobe first.
# partprobe
# pvcreate /dev/sda4
Physical volume "/dev/sda4" successfully created.Extend Volume Group
# vgextend centos /dev/sda4
Volume group "centos" successfully extended
# vgdisplay
VG Name centos
VG Size 38.99 GiB
Free PE / Size 5119 / <20.00 GiBExtend Logical Volume
# lvextend -l +100%FREE /dev/centos/root /dev/sda4
Size of logical volume centos/root changed from <18.00 GiB to <36.50 GiB.
Logical volume centos/root successfully resized.Resize Filesystem
Check Filesystem Type
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 37G 14G 24G 37% /Resize Filesystem
# xfs_growfs /dev/mapper/centos-root
data blocks changed from 4717568 to 9567232If the filesystem is ext4, use resize2fs instead.
Expansion completed!
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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
