This tutorial outlines how to install the rEFInd Boot Manager on a GPT partition. When using UEFI boot, you should understand you will require a bootable esp partition that houses either the Windows Boot Manager, GRUB2, or rEFInd. I don’t know much about MacOS so do not follow these instructions exactly if you are using Mac (some may apply).
To install and use rEFInd, you need a little EFI partition with rEFInd on it or by copying the files and setting up the boot entry manually.
Most people can just install rEFInd and then run refind-install. Work out if you’re on GPT or MBR partition table, how many drives you have, which one you want to boot from. Don’t run all the commands on this page until you’ve read it all. It’s not a perfect guide but it worked for me:
I now have:
- Arch on GPT NVME SSD (unbootable, no grub)
- Second GPT Hard Disk with 2GB fat32 following by 968GB of free space/ext4
Before the guide, I had:
- Arch on GPT NVME SSD (unbootable, no grub)
- Second MBR Hard Disk with one big NTFS partition
You should read most of the official page first too. I don’t have Windows so I don’t know if this will allow you to dual boot or triple boot to Mac.
If you have a ESP partition you can do this
sudo pacman -S refind-install
If you don’t have a little ESP partition, this guide may be for you.
During this tutorial we will be making a new fat32 partition on an unmounted disk that is bootable and installing rEFInd to that little partition.
If you only have one hard drive, you need to do all of this from the rEFInd live disk. I read that it doesn’t work on the Arch live USB because kernel files from the live USB are copied instead of the Arch kernel files.
If you have two hard drives on the computer, connect the drive you want to install boot partition on (rEFInd) with a caddy or HDD Drive Housing to USB and edit the partitions that way.
Be very careful resizing partitions with data as you can lose the data when resizing, no matter how careful you are.
It’s possible to use GPT on a data disk even on a BIOS-based computer, or to use an MBR data disk even on an EFI-based computer. Thus, if you examine the wrong disk, you can be led to an incorrect conclusion about your computer’s boot mode.https://www.rodsbooks.com/refind/bootmode.html
Another caveat relates to the use of a hybrid MBR, which is a variant on a GPT disk that’s most often used on Macs to permit booting Windows in BIOS mode and OS X in EFI mode. Most Windows tools will identify a hybrid MBR disk as an MBR disk, but most non-Windows tools will identify it as a GPT disk. Of course, as hybrid MBRs are generally used to enable dual-booting Windows and OS X, and as OS X boots in EFI mode, you should be able to install rEFInd from OS X to help manage such a dual-boot configuration.
There are many different scenarios that need to be discussed before deciding where to install the esp partition and with what software too.
The most important thing is to build a recovery USB first. If you don’t build a boot recovery USB and you modify your GRUB or rEFInd files, you will most likely leave your system unbootable. The most common reasons for not being able to boot are (I have experienced all of these lol):
- if you delete the Windows Boot Manager partition
- if you install Windows in GPT/MBR and your Linux installation is MBR/GPT
- if you delete GRUB2 entries
- if you auto-install GRUB2 or rEFInd
- if you try to install GRUB2 or rEFInd on a mounted disk (OS running)
- if you try to boot Windows in UEFI mode or legacy mode and installed Linux in the opposite of the one you booted in
- if you delete GRUB2 without installing rEFI
- if you delete boot or kernel files, or move them to abnormal places
- if you delete the wrong partition
- if you format the wrong partition into ext4 or fat32 or else
- if you leave Secure Boot on and cannot boot from USB
Step 1: Build a recovery USB to absolutely make sure you can boot again
Download the Super Grub2 Disk iso from the official website and use balenaEtcher to burn the ISO file to a USB. Make sure you burn to the right USB.
Or use the official rEFInd USB flash drive image file and use balenaEthcher to burn it.
Reboot now and test the recovery USB but only if you haven’t changed anything yet! Make sure your USB works. You might need to turn on Legacy Support, USB Boot, disable Secure Boot or change the boot order.
If you don’t have a USB, use a CD and burn the Super Grub2 Disk ISO onto the CD.
If you don’t have a CD or a USB stick, you must be very careful because you are making changes to boot processes of your computer. If you reboot, or power goes out, or your battery dies during the changeover process, you will have a big problem and most likely be unable to boot.
Do not proceed without a bootable drive, or second computer handy. I once had to install bootable EFI files onto my phone’s SD card and then try to boot into the SD card slot! Waste of time, get a USB handy.
Step 2: Check if you are using GPT or MBR partitioning
Since Arch linux is 64 bit by default, we skip a step here in figuring out whether we want 32bit or 64bit rEFInd.
Get GParted and Gnome Disks to edit disks with the GUI as command line will take hours.
sudo pacman -S gnome-disks gparted
Open BOTH gparted and Gnome Disks and check ALL the drives in both of those programs to check which drives are connected to your PC.
Make sure GPARTED and Gnome Disks show the EXACT same drives and order of all the partitions. I have experienced a discrepancy before where a drive was showing “Empty/Unallocated” in Gnome Disks but showing up perfectly in GParted. This is scary stuff. <– If this error happened to you, scroll to bottom I will explain how I saved my data
Check your drives in the shell terminal by first listing your removable media
And checking all of the sdX and nvmeX drives with fdisk -l to verify what Partition Tabling they are using.
Check your drives partitioning tables now :
sudo fdisk -l /dev/sda
sudo fdisk -l /dev/sdb
sudo fdisk -l /dev/nvme0n
Look for DOS or GPT.
DOS means MBR Partitioning. GPT means GPT…
DOS/MBR Partition can boot from the normal MBR partition and you should install GRUB or rEFInd there.
If you have a MBR linux disk without the Master Boot Record, or Windows Boot Manager, it won’t boot and you should either change the disk to GPT by moving all the data first to a separate disk and then back after the partition table change or you should install GRUB2/rEFInd to another whole disk. If you have Windows (I don’t) you will probably have to install it .
For GRUB or rEFInd to boot from a GPT-partitioned disk on a BIOS-based system, a BIOS boot partition is required. This is the little ESP I’ve been mentioning.
If the device you want to install your boot partition on is GPT then rEFInd will attempt to mount this partition and install on the esp boot partiition that we will be making in this tutorial.
If you have DOS/MBR partitioning and you want GPT partitioning, you need to move all your files on that entire disk to a backup disk, change the partition table in GParted, and after we finish the tutorial, move your files back. If you only have the one drive you can’t do this and need to install rEFInd in the MBR partition.
If you don’t have an MBR partition and you’re on a MBR drive, you need to move files first.
Even the maintainer of rEFInd suggests to move/backup files before attempting to change a disks partitioning table type. It is a risky process
Step 3: Partition the GPT disk with a fat32 esp partition
Serious error was incurred during this tutorial.
I used GPARTED to resize a MBR SSD disk to include a fat32 esp bootable partition after the main file system. Once changes were saved, the disk showed EMPTY and UNALLOCATED on Gnome Disks and did not even show the changes made on GParted. If this happens, use GParted to backup the partition with your data on it and start again. If you start creating new partitions over the top you will overwrite your data on that disk…
If it is a brand new drive with no data, open GParted, and select the device from the drop down menu, then select Device > Create Partition Table and choose GPT.
If you change the Partition Table on a drive with data on it, it will wipe the drive and make it GPT. You will lose all the data on that disk.
Once your drive is GPT, in GParted, create a little 2GB or so partition at the start with fat32 format and edit the flags to say esp.
Note: you can’t resize or create a little esp boot partition on the drive that you are currently booted on right now.
To install the rEFInd partition, you need to have a second disk inside the PC or you will not be able to partition the disk you are currently reading this on as it is live and mounted. GParted won’t let you resize this partition.
Once you have a little fat32 partiton (minimum 1-2GB) then you can run the rEFInd install script:
sudo pacman -S refind-install
# run again as first time it will mount the esp partition
Run it twice as it will mount the disk on the first run.
Reboot and see if you can boot in!