The boot partition flag is used to indicate that an MBR partition is bootable. Although MBR has been superseded by GUID Partition Table in recent years, MBR is still very prevalent across many systems. The boot loader resides on a bootable partition and is what tells your system where to look for the operating system.
In this tutorial, you will find the step by step instructions to set or change the boot partition flag on a Linux system via command line and GUI.
In this tutorial you will learn:
- How to set bootable partition flag via command line or GUI
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Software||MBR, fdisk, Disks GUI app|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to set or change boot partition flag on Linux step by step instructions
Use the approrpriate set of instructions below, depending on whether you want to change the boot partition flag via command line or GUI. The command line method is sure to work across any Linux distro.
Set/change boot partition flag via command line
- Open up a terminal and use the following
fdiskcommand to see which of your partitions currently has the bootable flag. This must be executed with root permissions.
$ sudo fdisk -l
In the output, you will see which partitions have a bootable flag. See the screenshot below for reference.
- To turn a bootable flag on or off, select your drive in
fdisk. We will be using drive
/dev/sdXas an example.
$ sudo fdisk /dev/sdX
- Enter the
aoption to toggle a bootable flag.
Command (m for help): a
- Next you will be asked to select a partition number. Enter your selection for the partition that you would like to toggle the boot flag on or off for.
- Finally, issue the
wcommand to write the changes you have just made.
fdiskwill then automatically exit.
Command (m for help): w The partition table has been altered. Syncing disks.
That’s all there is to it. Repeat the steps as necessary if you need to toggle another disk partition’s bootable flag on or off. Check the
fdisk -l output to verify changes that you make.
Set/change boot partition flag via GUI
These steps are going to vary depending on which distro and desktop environment you are using. However, most or all systems have a disk management application similar to the one we are using below, so you should be able to follow along. We are using GNOME on Ubuntu in these steps.
- Start by opening your disk management application. It is simply called
Diskson our system.
- Now highlight the partition you want to edit, click the cog wheel, and click Edit Partition.
- Finally, toggle the bootable flag on or off. Then you can finalize your changes with the “Change” button and close the disk management application.
In this tutorial, we saw how to set or change the boot partition flag on Linux. This can be done via command line or GUI, although the instructions for GUI will vary depending on your system. This is only helpful for MBR disks, which are becoming outdated in favor of GUID but it is still common to find them.