KB
Storage & Filesystems

Extending partition size by adding new disk LVM Linux

4 min read737 words15 code blocks

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:

ApproachRiskWhen to use
Add a new disk (this article)Low — existing partition tables untouchedPreferred in almost all cases
Enlarge the existing diskHigh — edits a live partition tableOnly 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:

bash
df -hT
sudo vgs
sudo lvs

Procedure#

1. Make the OS see the new disk#

bash
echo "- - -" | sudo tee /sys/class/scsi_host/host0/scan
lsblk

If several SCSI hosts exist, scan them all:

bash
for h in /sys/class/scsi_host/host*/scan; do echo "- - -" | sudo tee $h; done
lsblk

The 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#

bash
sudo blkid /dev/sdb

No 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:

bash
sudo pvcreate /dev/sdb
sudo pvs
Note: The older approach of creating a partition with fdisk and setting type 8e still 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:

bash
sudo vgdisplay

Add the new physical volume to it:

bash
sudo vgextend centos /dev/sdb

Replace centos with your actual VG name.

Confirm the free space appeared:

bash
sudo vgs

VFree should now show the size of the new disk.

5. Extend the logical volume#

Identify the LV to grow:

bash
sudo lvdisplay

Use all newly available space:

bash
sudo lvextend -l +100%FREE /dev/centos/root

Or add a specific amount:

bash
sudo lvextend -L +10G /dev/centos/root

6. Grow the filesystem#

Check the filesystem type first:

bash
df -hT /

Then run the matching command:

bash
# xfs — takes the MOUNT POINT
sudo xfs_growfs /

# ext4 — takes the DEVICE PATH
sudo resize2fs /dev/centos/root

Both work online, with the filesystem mounted and in use.

Tip: On RHEL 8+ and recent Ubuntu, lvextend -r does steps 5 and 6 together and selects the correct filesystem tool for you: ``bash sudo lvextend -r -l +100%FREE /dev/centos/root ``

Verification#

bash
df -hT
sudo pvs
sudo vgs
sudo lvs

The mount point should report the new total. Reboot and confirm it persists:

bash
sudo reboot

Nothing needs to be added to /etc/fstab — the mount already exists and LVM assembles the volume group automatically at boot.

Troubleshooting#

SymptomCause and fix
New disk not visible after rescanScan every SCSI host, or reboot. Confirm the disk was actually attached in vSphere.
Device /dev/sdb excluded by a filterThe 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 foundWrong VG name. Confirm with sudo vgs.
Insufficient free extentsRequested more than is available. Use -l +100%FREE instead of a fixed size.
df unchanged after lvextendThe filesystem was not grown. Run step 6.
xfs_growfs: not a mounted XFS filesystemYou passed the device path. xfs_growfs takes the mount point.