Extending partition size by adding new disk LVM Linux
At a glance#
- Purpose: Grow an existing LVM logical volume by adding a brand-new disk to its volume group.
- Applies to: Linux VMs on VMware or any hypervisor that supports hot-adding disks.
- Risk: Low — nothing on the existing disks is modified.
- Time: About 20 minutes.
Overview#
There are two ways to give an LVM volume more space:
| Approach | Risk | When to use |
|---|---|---|
| Add a new disk (this article) | Low — existing partition tables untouched | Preferred in almost all cases |
| Enlarge the existing disk | High — edits a live partition table | Only when adding a disk is not possible |
Prefer this method. Adding a disk never touches the partition table of a running system, so the failure modes are far less severe. There is no good reason to edit a live partition table when the hypervisor can simply present another disk.
Before you start#
- Root access.
- A new virtual disk added to the VM (vSphere → Edit Settings → Add New Device → Hard Disk).
- The name of the volume group you intend to extend.
Record the current state:
df -hT
sudo vgs
sudo lvsProcedure#
1. Make the OS see the new disk#
echo "- - -" | sudo tee /sys/class/scsi_host/host0/scan
lsblkIf several SCSI hosts exist, scan them all:
for h in /sys/class/scsi_host/host*/scan; do echo "- - -" | sudo tee $h; done
lsblkThe new disk appears with no partitions and no mount point — for example /dev/sdb.
Note: If it still does not appear, reboot. A reboot always detects new hardware, and on a VM it is quick.
2. Confirm the disk is empty#
sudo blkid /dev/sdbNo output means no filesystem is present. Any output means stop and confirm you are looking at the right disk.
3. Create a physical volume#
You can hand the whole disk to LVM directly. This is simpler than partitioning it first and avoids a class of alignment problems:
sudo pvcreate /dev/sdb
sudo pvsNote: The older approach of creating a partition withfdiskand setting type8estill works and you will see it in existing systems. It is not necessary on a dedicated LVM disk, and skipping it removes a step where mistakes happen.
4. Extend the volume group#
Find the VG name:
sudo vgdisplayAdd the new physical volume to it:
sudo vgextend centos /dev/sdbReplace centos with your actual VG name.
Confirm the free space appeared:
sudo vgsVFree should now show the size of the new disk.
5. Extend the logical volume#
Identify the LV to grow:
sudo lvdisplayUse all newly available space:
sudo lvextend -l +100%FREE /dev/centos/rootOr add a specific amount:
sudo lvextend -L +10G /dev/centos/root6. Grow the filesystem#
Check the filesystem type first:
df -hT /Then run the matching command:
# xfs — takes the MOUNT POINT
sudo xfs_growfs /
# ext4 — takes the DEVICE PATH
sudo resize2fs /dev/centos/rootBoth work online, with the filesystem mounted and in use.
Tip: On RHEL 8+ and recent Ubuntu,lvextend -rdoes steps 5 and 6 together and selects the correct filesystem tool for you: ``bash sudo lvextend -r -l +100%FREE /dev/centos/root``
Verification#
df -hT
sudo pvs
sudo vgs
sudo lvsThe mount point should report the new total. Reboot and confirm it persists:
sudo rebootNothing needs to be added to /etc/fstab — the mount already exists and LVM assembles the volume group automatically at boot.
Troubleshooting#
| Symptom | Cause and fix |
|---|---|
| New disk not visible after rescan | Scan every SCSI host, or reboot. Confirm the disk was actually attached in vSphere. |
Device /dev/sdb excluded by a filter | The disk carries an old signature. Inspect with wipefs /dev/sdb; clear with sudo wipefs -a /dev/sdb only if it is confirmed empty. |
Volume group "centos" not found | Wrong VG name. Confirm with sudo vgs. |
Insufficient free extents | Requested more than is available. Use -l +100%FREE instead of a fixed size. |
df unchanged after lvextend | The filesystem was not grown. Run step 6. |
xfs_growfs: not a mounted XFS filesystem | You passed the device path. xfs_growfs takes the mount point. |