I have attempted to expand the volume of an Ubuntu 18.04 server running on vmware. LVM is in use. I shut it down, expanded the virtual disk in vmware, and powered it up. I then used cfdisk to resize the 40GB /dev/sda3 to the max of 199GB. That went fine.
Output of cfdisk after reboot:
/dev/sda1 = 1M
/dev/sda2 = 1G
/dev/sda3 = 199G
I then ran df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 798M 1.1M 797M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 39G 4.0G 33G 11% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/loop0 90M 90M 0 100% /snap/core/8268
/dev/loop1 92M 92M 0 100% /snap/core/8592
/dev/sda2 976M 145M 765M 16% /boot
tmpfs 798M 0 798M 0% /run/user/1000
I know I need to expand /dev/mapper/ubuntu--vg-ubuntu--lv so I tried
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.44.1 (24-Mar-2018)
The filesystem is already 10222592 (4k) blocks long. Nothing to do!
Output of vgdisplay
--- Volume group ---
VG Name ubuntu-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <39.00 GiB
PE Size 4.00 MiB
Total PE 9983
Alloc PE / Size 9983 / <39.00 GiB
Free PE / Size 0 / 0
VG UUID TXiMWd-sKCj-2nJc-yEZY-ZudW-DMOh-G2qc6d
Output of pvdisplay
--- Physical volume ---
PV Name /dev/sda3
VG Name ubuntu-vg
PV Size <39.00 GiB / not usable 0
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 9983
Free PE 0
Allocated PE 9983
PV UUID rmuSVO-uUCF-iKiA-0v8Q-IScl-zvHd-jfAzMn
I also tried
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
New size (9983 extents) matches existing size (9983 extents).
So my issue is that in cfdisk, it says /sda3 is 199G. However I can't figure out how to extend
/dev/mapper/ubuntu--vg-ubuntu--lv 39G 4.0G 33G 11% /
to fill the remaining ~160GB space on /sda3.
I would greatly appreciate any guidance. I was following the "faster method" here: Increase partition size on which Ubuntu is installed?
And now I seem to be stuck.
I should add that I also tried this, but it doesn't seem to like it on a mounted filesystem.
vgextend ubuntu-vg /dev/sda3
Can't open /dev/sda3 exclusively. Mounted filesystem?