We're running Ubuntu 16.04.6 LTS as a VM under Hyper-V - no UI, so gparted isn't really an option.
We were running low on space on /dev/sda3 so I expanded the drive inside of Hyper-V, then ran:
sudo parted -l
It warned:
Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 20971520 blocks) or continue with the current setting? Fix/Ignore? Fix
After fixing, I see running fdisk -l that /dev/sda is now 100 GiB.
It's not really clear to me how to assign this extra space to /dev/sda3 - I tried just expanding the logical volume that is at 99% usage (the one that prompted me to try to expand the space available in the first place):
sudo lvextend /dev/srv-vg/root /dev/sda3
But I think that since the space isn't assigned to sda3 it can't expand it (as it didn't really expand it).
So then I tried parted:
$sudo parted /dev/sda
resize part 3
End? [85.9GB]? -0
(parted): quit
Information: You may need to update /etc/fstab
fdisk -l now shows sda3 has more space, but it still shows that 99% of the space is used.
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 2050047 999424 488M Linux filesystem
/dev/sda3 2050048 209715166 207665119 99G Linux LVM
Disk /dev/mapper/srv--vg-root: 77 GiB, 82703286272 bytes, 161529856 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
I tried lvextend again:
sudo lvextend /dev/srv-vg/root /dev/sda3
but it says this:
No free extents on physical volume "/dev/sda3".
No specified PVs have space available.
I rechecked vgdisplay:
--- Volume group ---
VG Name srv-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 79.02 GiB
PE Size 4.00 MiB
Total PE 20229
Alloc PE / Size 20217 / 78.97 GiB
Free PE / Size 12 / 48.00 MiB
VG UUID HvKrjH-VGRA-svAB-NOmW-f23C-7uwq-hdh5Ja
It feels like I'm almost there, but I'm not seeing what else I need to do to expand this.
What am I missing here?