In the world of system administration, managing disk partitions is a common task. One of the tools you may use for this purpose is GParted, a free partition editor for graphically managing disk partitions. In this article, we will guide you through the process of setting the bios_grub flag to a partition in GParted. This is particularly useful when you’re setting up a dual-boot system or dealing with a legacy installation on a GPT disk.
What is the ‘bios_grub’ Flag?
The bios_grub flag is used to designate a partition as a BIOS boot partition. This is necessary for systems using BIOS firmware on a disk using the GUID Partition Table (GPT) format. The BIOS boot partition is used by GRUB (GRand Unified Bootloader) to embed its core.img file in the absence of a post-MBR gap.
Prerequisites
Before we get started, you will need a live USB of Ubuntu. If you don’t have one, you can follow this guide to create it.
Creating a BIOS Boot Partition in GParted
Follow the steps below to create a BIOS boot partition and set the bios_grub flag:
Boot into a live USB of Ubuntu. Restart your computer and boot from the live USB.
Open GParted. Once you’re in the live Ubuntu environment, open GParted from the applications menu.
Create a new partition. Select the unallocated space on your disk and click on the “New” button to create a new partition. The partition should be more than 1MB in size and its file system should be set as unformatted.
Set the ‘bios_grub’ flag. Right-click on the newly created partition and select “Manage Flags” from the drop-down menu. In the “Manage Flags” window, check the box for bios_grub and click “Close” to apply the changes.
Please note that creating a BIOS boot partition is not the correct fix if your system was previously booting properly. This fix is specifically for mounting a legacy installation on a GPT disk and may prevent you from booting into Windows.
Alternative Solution: Reinstalling GRUB in EFI Mode
If you were previously able to boot into Ubuntu, it is recommended to reinstall GRUB in EFI mode. Here are the steps:
Boot into the live USB of Ubuntu in UEFI mode. This is important because the mode in which you boot the live USB determines the mode in which GRUB will be installed.
Access your installed Ubuntu system. Open a terminal and run the following commands:
sudo mount /dev/sdXY /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
Replace /dev/sdXY with the actual partition where your Ubuntu system is installed (e.g., /dev/sda1). These commands mount the necessary filesystems and enter a chroot environment where your installed Ubuntu system is the root filesystem.
Reinstall GRUB. Once you are in the chroot environment, reinstall GRUB by running the following command:
sudo grub-install /dev/sdX
Replace /dev/sdX with the disk where your Ubuntu system is installed (e.g., /dev/sda). This command installs GRUB to the specified disk.
Update GRUB. Run the following command to update GRUB:
sudo update-grub
This command generates the GRUB configuration file based on your installed operating systems.
Exit the chroot environment and reboot. Type exit to leave the chroot environment and then reboot your system.
Always boot in UEFI mode if your Windows installation is using UEFI. This will ensure that the correct version of GRUB is installed.
Conclusion