Create a copy of fedora boot and filesystem partition and create a new grub instance for it

After a partly successful dual boot with Fedora 40 and Windows 10. I had to delete my blocked Windows boot from my SDD. I removed the EFI entry and the two Windows specific partitions. Now I would like to install Windows again but give my Linux installation more space on the disk (from 100Gb to 300Gb) but this is sadly not so easy because both of my Linux partitions (boot & file system) are at the physical end of the SSD. So I have to move my both Linux partitions to the beginning of my SSD. What I want to achieve is to create a copy of the boot partition and copy the content of the file system to a bigger partition. Now I don’t want to make updates to my existing grub bootloader that was installed with Fedora on the EFI partition. I want to create a new grub bootloader that will be available as a separate UEFI boot entry and that will boot into the copy of the Fedora system. Only when I’m completely sure that my new setup works, I want to delete the old partitions, so in case when I make a mistake I can still boot into the original Fedora installation. The new setup has to support secure boot with UEFI and I would like that everything can be done without using a live OS.

This is a screenshot from my current GParted state

This is my idea of how to make this process the most secure, but if anyone has a better idea, I’m open for new ideas.

Thank you

That sort of thing can be done from the dracut rescue shell (reachable by appending rd.break=pre-mount to your kernel parameters), but it might be a little more difficult since you won’t have a web browser that you can copy-and-paste commands from.

Basically, you would need to create and format your partitions beforehand, then use cp -a <source> <destination> (or Btrfs’ send and receive commands for Btrfs filesystems) to copy the data. Then manually add an entry to your boot menu to boot the copy of the OS that is on the new partitions.

Edit: Actually, with Btrfs, you could copy (send/receive) a snapshot, so you wouldn’t have to do this from dracut’s rescue shell if you are using Btrfs.

Thank you for your answer, but I’m pretty new to this stuff, so I don’t completely understand your answer or what you are trying to say. I completely agree about copying the content of the partitions with the command you have provided. But what do you mean with boot menu. If you mean the grub boot menu, then I imagine this wouldn’t work because grub would still load the configuration from the old boot partition…? Could you please elaborate on this?

You are probably correct. It is unfortunate that GRUB spreads itself across multiple partitions like that (ideally everything would be on the ESP). Consequently, to get GRUB to temporarily use your new “boot” partition, you would likely need to drop to GRUB’s command line and run something like set root=hd0,gpt2, then set prefix=($root)/grub2, then configfile $prefix/grub.cfg. Caveat emptor, those commands were stitched together from memory and some quick google searches. You might want to echo out the values of the variables before overwriting them to see how they are supposed to look for Fedora Linux. I cannot (easily) test the commands because I gave up on GRUB and switched to systemd-boot a long time ago. But if it works, that last command should load the contents of the boot partition you have on gpt2.