Hey there folks,
Lately I have installed fedora 34 on my computer. I have done a manually partitioning with 4 partitions respectively for: /boot/efi, /root, /swap and /home. After installation I discovered that the Fedora documentation explicitly recommends creating a separate boot partition.
So I plan to create a new partition and copy the boot directory over from the root directory to the root of the new partition. Change the fstab file to include the new /boot partition and reinstall grub by following the procedure from the fedora documentation.
Now this sounds easy but I don’t want to end up with a system that won’t boot, so I would definitely appreciate your feedback on this plan. Do you think this would work out fine or is there still a catch here that I didn’t think of? Please let me know.
I think it will work fine. I would do it something like this:
sudo mkdir /mnt/newboot
sudo mount <new partition> /mnt/newboot
sudo rsync -aAXHv /boot/ /mnt/newboot
sudo umount /mnt/newboot
sudo rmdir /mnt/newboot
/etc/fstab to include the partition.
Test the fstab mount using:
sudo mount /boot
After rebooting and ensuring everything is working, temporarily unmount
/boot and remove all the stuff from the old
/boot and then remount it.
I am not really a grub expert as the first thing I do after installing Fedora is remove it but does changing the
/boot partition require reinstalling grub? On the other hand, it shouldn’t hurt to reinstall it.
A couple of notes:
- Be sure to set the mount options for the partition appropriately in
/etc/fstab. If you don’t lock it down, there is little reason to have a separate
- I would recommend using
rsync instead of
cp as described above. With those options it should make a fairly exact copy.
- Make sure you test your fstab changes before rebooting!
Ditto. But just for the record, yes, Grub’s first-stage bootloader compiles the boot filesystem’s UUID into the “core” binary. If you change the filesystem’s UUID (in this case from / to /boot), you will need to re-install Grub. Well, that is for BIOS booting. For EFI booting, I think there has been a recent change so that the boot filesystem’s UUID is stored in /boot/efi/EFI/fedora/grub.cfg.
Excerpted from Changes/UnifyGrubConfig:
The proposal is to always store the
grubenv files in the
/boot/grub2/ directory, making
/boot/efi/EFI/fedora/grub.cfg to only be a small configuration file that sets a different
$prefix variable and loads the configuration file stored in
$prefix variable will be set to the device partition where
/boot/grub2/grub.cfg is stored, using the partition filesystem’s Universally Unique IDentifier (UUID). That way the correct GRUB configuration file will be loaded, making it as secure as the current approach where the configuration file in the ESP is used.
In summary, grub is very complicated and very easy to break.
I have completely rearranged my storage, so I can definitely speak with some confidence. If you’re just moving /boot, copying everything over, and reinstalling GRUB, should be enough.
If you’re using UEFI, with an ESP mounted at /boot/EFI, then you’ll want to be sure that that is where GRUB is installed, and only after everything has been moved, and set up.
As @dalto said, make sure that your /boot is listed correctly in /etc/fstab, and test that it’s working correctly.
You may also want to rebuild your initramfs images using dracut, just in case. For me, doing this broke the plymouth boot screen, but that doesn’t really do anything important, and should be fixable by forcing dracut to include plymouth.
Though, there’s not a severe need to use a separate /boot partition. It is advisable, but the reason for using separate partitions is typically so that, in the event that one partition experiences some sort of filesystem corruption, it won’t effect the other partitions. barring something extreme, like drive failure, filesystem corruption is rather rare, and rarely fatal, on most modern filesystems.
In my personal experience, the ESP is more likely to get fataly corrupted than the rest of your filesystem, as it’s using the older FAT filesystem, which has fewer safeguards in place.
Thank you all very much for your feedback and useful tips. Now I can move the boot folder to a new partition with more confidence. One question still remains:
How does one test the changes to fstab before rebooting?
When you use the
mount command without a source device it looks in
/etc/fstab. So after making the changes to
/etc/fstab and with your new partition unmounted you can do:
sudo mount /boot
Then check if your new partition is mounted to
/boot. If it is, it worked.