I recently needed to grow the file system on a Linux VM. I remembered writing a post on this before, so I headed here:
Unfortunately this previous post assumed a non-LVM disk setup.
I needed to increase the size of the
/data mountpoint using the filesystem
/dev/mapper/data_vg-data and the earlier instructions did not work. My VM had three disks. To figure out which one I needed to grow, I used the Linux
lsblk command. This showed three disks,
/data mountpoint went to
sdb, which was 60GB in size. Looking at the VM, Hard Disk 2 was the only one that was 60 GB. I increased it to the necessary size in the vCenter UI.
Back in the VM I needed to resize the filesystem to match the new disk size. To do this I first ran
pvresize /dev/sdb which returned the message that 1 physical volume(s) resized or updated.
I then ran
lvdisplay looking for the ‘data’ volume group, specifically the
LV Path property, which in this case was
From here I ran
lvextend -l +100%FREE /dev/data_vg/data which returned a message that the size of logical volume had changed to the new size of the disk.
Finally I ran
resize2fs /dev/data_vg/data which confirmed that the filesystem was resized on-line.
df -h now shows the expected size for the mount.