| README.md | ||
Boot Partition Remove
This process walks through an EFI RHEL based (RHEL, Centos, Rocky, Alma) distro that has a /boot partition that you want to remove. This commonly occurs because the /boot partition does not have enough space for the linux initramfs image to be create which breaks update.
Make sure that you have a backup of the system before preforming this opperation as it can leave it in an unbootable state.
Instructions
All the steps in the instructions assume the boot partition is located at /dev/vda3 and 4bc43a01-3597-4d21-95d1-31acd384f7c8 is the UUID of the root partition. Use the proper partition for your setup in any commands that reference it.
Disable /boot partition in the fstab config and grab the UUID of the root drive for future use
sudo vi /etc/fstab
Unmount /boot from the running system
sudo umount /boot/efi
sudo umount /boot
Reload the daemon after editing the fstab file
sudo systemctl daemon-reload
Create the /boot/efi directory for mounting
sudo mkdir /boot/efi
Remount the efi partition so everything matches the fstab file
sudo mount -a
Temporarily mount the boot partition to copy the data replacing /dev/vda3 with the partition in question
sudo mount /dev/vda3 /mnt
sudo cp -R /mnt/* /boot/
sudo cp -R /mnt/.* /boot/
sudo umount /mnt
Delete the /boot partition
sudo fdisk /dev/vda
d # Delete partitions
3 # Delete the 3rd partition so it is /dev/vda3
w # Write changes
Update the following lines in the grub config with the UUID of the root partition and add "/boot" to the end of the set boot variable
sudo vi /boot/efi/EFI/rocky/grub.cfg
search --no-floppy --root-dev-only --fs-uuid --set=dev 4bc43a01-3597-4d21-95d1-31acd384f7c8
set prefix=($dev)/boot/grub2
Rebuild the grub config
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Update or reinstall kernel (only if current kernel broken)
sudo dnf update -y
#sudo dnf reinstall kernel* -y
Troubleshooting
Grub entries broken
The previous grub entries will be broken until the image is regenerated (either installing a new version or reinstalling). To manually force an entry to boot, add /boot to the path after ($root) for the linux and initrd lines.
Once you are booted back into the system, reinstall the current kernel
sudo dnf reinstall kernel* -y
GRUB Boots to command line
If grub boots to the command line with no menu options it likely was unable to load the configuration.
Run the set command to see the current configuration settings.
Use ls to see the available partitions
Update the root to your root partition
set root=(hd0,gpt4)
Attempt to load the config file
configfile (hd0,4)/boot/grub2/grub.cfg
If it is unable to find the device, the grub config was likely not regenerated and will need to have the device UUID swapped to the root partition. Once you are able to boot once sucessfully you will need to regenerate the config for the new version
sudo grub2-mkconfig -o /boot/grub2/grub.cfg