analyst@unixshadow:~$ lvm-resize –xfs –ext4 –vmware # growing works for both, shrinking only for ext4
Growing and Shrinking LVM Volumes
XFS, ext4, and parted Under VMware
Growing a disk under VMware is a four-layer job: the VMDK, the partition (if any), the physical volume, the logical volume, and finally the filesystem. Miss a layer and the space never shows up in df. This guide covers growing for both XFS and ext4, and shrinking — which only ext4 can do.
# the one rule — make your decision based on which filesystem you have
XFS: grows with
ext4: grows online with
check first:
xfs_growfs, mounted, online — and that is all it does. There is no shrink tool.ext4: grows online with
resize2fs, and it is the only one of the two that can shrink — offline, unmounted.check first:
df -hT /mountpoint tells you which filesystem you have before anything else.So growing works the same for both; shrinking exists only for ext4. Everything below follows from that one line.
# before you start — four checks, in order
1. Back up. Especially before any shrink.
2. Record the current state:
3. VMware first: delete or consolidate snapshots. A VM with snapshots cannot extend its virtual disk — vSphere blocks it. Hot-extending while the VM runs is supported, but only with no snapshots present.
4. Know your PV layout: is the physical volume the whole disk (
2. Record the current state:
lsblk, df -hT, pvs, vgs, lvs.3. VMware first: delete or consolidate snapshots. A VM with snapshots cannot extend its virtual disk — vSphere blocks it. Hot-extending while the VM runs is supported, but only with no snapshots present.
4. Know your PV layout: is the physical volume the whole disk (
/dev/sdb) or a partition (/dev/sda3)? The partition case needs one extra step below.# growing a volume — XFS and ext4, same steps
1. In vSphere, edit the VM, select the hard disk, and increase its size.
2. Rescan so the guest sees the bigger disk:
3. If the PV sits on a partition, grow the partition first:
4. Grow the physical volume:
5. Grow the logical volume, and let it resize the filesystem in the same step:
6. Verify:
2. Rescan so the guest sees the bigger disk:
echo 1 > /sys/class/block/sdb/device/rescan (adjust the disk name; rescan-scsi-bus.sh from sg3_utils does the same job). Confirm with lsblk — the disk should show its new size while the PV does not, yet.3. If the PV sits on a partition, grow the partition first:
growpart /dev/sda 3 (cloud-utils-growpart — or parted resizepart, covered below). Whole-disk PVs skip this step.4. Grow the physical volume:
pvresize /dev/sda3 (or /dev/sdb for a whole-disk PV). pvs should now show a larger PSize and vgs should show free space (VFree).5. Grow the logical volume, and let it resize the filesystem in the same step:
lvextend -r -l +100%FREE /dev/vg0/lv_data (or -L +10G for a fixed amount). The -r flag hands the filesystem step to fsadm, which runs xfs_growfs for XFS and resize2fs for ext4. Without -r, do it manually: XFS, mounted: xfs_growfs /mountpoint (it takes the mount point — the classic form). ext4, mounted grow is fine: resize2fs /dev/vg0/lv_data.6. Verify:
df -hT /mountpoint and lvs.# parted vs lvm — different layers, different tools
parted works on partitions: it edits the partition table on a disk. Inspect it:
LVM commands work on the layers above:
growpart vs parted: growpart is the one-command online grower — grow only, simplest for the VM case in this guide. parted is the general partition editor (create, delete, inspect, plus resizepart). Either grows the partition; neither touches LVM. parted resizepart sometimes needs a table re-read (
whole-disk PV: no partition table exists, so parted has nothing to do — go straight to
the diagnostic:
parted /dev/sda print. Create a partition for a new PV: parted /dev/sda mkpart primary 0% 100%. Grow a partition after the disk grew: parted /dev/sda resizepart 3 100% (partition 3 to the end of the disk).LVM commands work on the layers above:
pvresize grows the PV to fill the partition, lvextend grows the LV, xfs_growfs / resize2fs grow the filesystem. parted never touches any of these, and no LVM command touches the partition table.growpart vs parted: growpart is the one-command online grower — grow only, simplest for the VM case in this guide. parted is the general partition editor (create, delete, inspect, plus resizepart). Either grows the partition; neither touches LVM. parted resizepart sometimes needs a table re-read (
partprobe) afterwards on a stubborn layout.whole-disk PV: no partition table exists, so parted has nothing to do — go straight to
pvresize.the diagnostic:
lsblk shows every layer’s size in a tree. Find the layer that is still small, and that is the tool you need: disk small → vSphere; partition small → parted/growpart; PV small → pvresize; LV small → lvextend; filesystem small → xfs_growfs/resize2fs.The confusion comes from treating them as alternatives. They are not — they stack. parted changes the partition; LVM commands change what sits on top of it. Running parted on an LV, or lvextend on a partition, fails because each tool only sees its own layer. Modern parted cannot resize filesystems at all, so it never substitutes for the filesystem step.
# shrinking a volume — ext4 only
XFS stops here: there is no shrink tool. The only way to make an XFS volume smaller is to back up the data, remove and recreate the LV at the smaller size, make a fresh filesystem, and restore.
For ext4, the order is everything — filesystem first, LV second, never the reverse.
1. Back up. Then unmount — shrinking ext4 requires it offline:
2. Check the filesystem:
3. Shrink the filesystem first. Never shrink the LV first — that destroys any data past the new end:
4. Then shrink the LV to match:
5. Remount and verify:
umount /mountpoint.2. Check the filesystem:
e2fsck -f /dev/vg0/lv_data.3. Shrink the filesystem first. Never shrink the LV first — that destroys any data past the new end:
resize2fs /dev/vg0/lv_data 20G.4. Then shrink the LV to match:
lvreduce -L 20G /dev/vg0/lv_data (it will warn; confirm). Or do both in one step and let fsadm order it safely: lvreduce -r -L 20G /dev/vg0/lv_data.5. Remount and verify:
mount /mountpoint; df -hT /mountpoint.One more thing: shrinking the guest volume does not shrink the VMDK. The datastore does not give the space back automatically — reclaiming it is a separate job, and often one that is simply skipped.
# gotchas — the six ways this goes wrong
-r and let fsadm order it.df first; resize2fs will refuse if the target is too small, but check anyway.xfs_growfs on ext4 (or resize2fs on XFS) just fails. df -hT first, every time.# quick reference — the whole post in three lines
Grow: vSphere extend → rescan → (growpart/parted) → pvresize → lvextend -r → verify.
Shrink (ext4): backup → umount → e2fsck → resize2fs → lvreduce → mount → verify.
XFS: grow only.
Shrink (ext4): backup → umount → e2fsck → resize2fs → lvreduce → mount → verify.
XFS: grow only.
Series: GuidesStatus: Restyled 25 Oct 2026
