how do I move the Fedora partition to before the boot ext4 partition and resize it?
The answer may be surprising: You don't have to do that.
Since you are using LVM and are not aiming to extend a non-LVM partition (i.e. /boot
), you don't have to extend the existing PV. Instead, you can make a new partition out of the unallocated space, use pvcreate
to make it a second LVM PV, then vgextend
to add it into your existing volume group.
With LVM, your volume group may consist of one PV, or many PVs, on one or more disks; LVM does not care about that. All the PVs in a single VG will act together as a single pool of disk space. You can then extend or create new LVs freely, without needing to care where one PV ends and another begins. It will all be handled transparently by LVM.
First, use gparted
or any tool you like to make that unallocated space into an usable partition. You should set its type ("flags" in gparted
) as lvm2 pv
, but strictly speaking you don't have to. I'll assume that it will be named /dev/nvme0n1p7
.
Verify that the new partition is visible in /proc/partitions
, indicating that the kernel has accepted the new partition table. If that did not happen, you may need to run partprobe /dev/nvme0n1
and check again. If the partition is still not recognized by the kernel, you may need to reboot at this point.
Once the partition is visible, you can proceed. Use pvs
to see if gparted
already initialized the partition as a LVM PV; if not, run pvcreate /dev/nvme0n1p7
to initialize it.
Then, assuming that your LVM volume group uses the default name fedora
, run vgextend fedora /dev/nvme0n1p7
.
Now the previously-unallocated space has been added to the volume group, and you can use it to extend existing LVs and/or create new ones as you wish.