sudo lvdisplayThis should show you the layout of your logical volumes. With my install this displayed as --- Logical volume --- LV Path /dev/ubuntu-vg/root LV Name root VG Name ubuntu-vg ... --- Logical volume --- LV Path /dev/ubuntu-vg/swap_1 LV Name swap_1 VG Name ubuntu-vg ... Here we can see that /dev/ubuntu-vg/root and /dev/ubuntu-vg/swap_1 are what I will need to resize/move first
sudo lvreduce --resizefs --size -250G /dev/ubuntu-vg/rootlvreduce will shrink the root ( " /" ) logical volume by the size specified by '--size -XG' where X is the number of gigabytes. The size of the logical volume before was ~450 GB, so this shrinks it down to ~200 GB.
lvdisplay --mapwhich will display the range that the logical volumes take up and it will display something like --- Segments --- Logical extent 0 to 639: Type linear Physical volume /dev/sda5 Physical extents 0 to 639 --- Segments --- Logical extent 0 to 31: Type linear Physical volume /dev/sda5 Physical extents 1544 to 1575
pvmove --alloc anywhere /dev/sda5:1544-1575 /dev/sda5:640-671which will move the logical volume of /dev/ubuntu-vg/swap_1 (the second segment listed) to be positioned exactly next to /dev/ubuntu-vg/root (the first segment listed). You will want to replace the values here with the ones that lvdisplay shows you. These are not my values, these are pulled from the explanation linked above. Now that you have all your logical volumes moved to be contiguous in the physical volume, you can go into GParted and resize the physical volume.