So this is an overview of your first disk layout:
/dev/sda 119 GiB
Partition Type Size FS Type Label Mount Point
+- /dev/sda1 Primary 243 MiB ext2 /boot
+- /dev/sda2 Extended 119 GiB
+- /dev/sda5 Logical 119 GiB LVM2 PV ubuntu-vg (LVM Volume Group name)
+- /dev/mapper/ubuntu--vg-root LVM LV 115.5 GiB ext4 /
+- /dev/mapper/ubuntu--vg-swap_1 LVM LV 3.5 GiB swap
So to answer your original question:
I am trying to shrink a partition. This is Ubuntu 18.04. df shows that it is far from full: only 41% in use. Yet, when I run gparted (from the live CD) it shows use: 100%. Unsurprisingly, gparted refuses to shrink said partition.
Any ideas why I am getting this discrepancy?
So you must have been looking at sda5 and seen the LVM Physical Volume as 100% full, containing the Volume Group ubuntu-vg (and it's fully sized Logical Volumes for the root file system and reportedly unused swap).
MAKE SURE YOU HAVE BACKUPS OF ANY DATA YOU CARE ABOUT.
GParted only handles a sub-part of LVMs; the Physical Volumes, not the Volume Groups or Logical Volumes. Therefore some of the follow are commands to be run on the command line:
1. Boot from GParted Live CD (or other Live CD with GParted). This is to allow the root (/) file system to be shrunk.
2. Shrink root (/) file system by 256 MiB. Close GParted and run "gparted /dev/mapper/ubuntu--vg-root". Resize the file system making it 256 MiB smaller than before. Apply operation and close GParted.
3. Shrink root volume group by 256 MiB. This can't be done in GParted. Run:
lvm lvresize --size -256M /dev/ubuntu-vg/root
4. Run GParted.
5. If sda5 is active (lock or key symbol in Partition column), deactivate it.
6. Resize sda5 making it 256 MiB smaller than before. NOTE: This might succeed or might fail with "cannot resize to XXX extents as later ones are allocated". Assuming it succeeds continue.
7. Move sda5 to the right as far as possible (by 256 MiB). Apply.
8. Move sda2, the start of the extended partition as far to the right as possible (by 256 MiB). Apply.
9. Finally grow sda1 as much as possible (by 256 MiB). Apply.
10. Reboot back to Ubuntu.
If shrink of sda5 failed with "cannot resize to XXX extents as later ones are allocated" then:
a. Based on your claim that /dev/ubuntu-vg/swap_1 is not used, delete it:
lvm lvremove /dev/ubuntu-vg/swap_1
b. Go back and re-run from step 6. onwards.
If /dev/ubuntu-vg/swap_1 is used Ubuntu probably won't boot and you'll have to remove that entry from /etc/fstab to fix.