What Is Boot Partition in Linux - A Full Guide

If you use a partitioning tool and point it at your HDD, you’ll have a chance to see a small boot partition before everything else. It only eats up a tiny fraction of your hard disk and does not appear whenever you actively use your system. Now you may wonder - is that partition needed? Here is everything you need to know about Linux boot partitions.

What Is Boot Partition in Linux?

Most computer systems have their storage divided into smaller units, which they call partitions. These partitions organize the contents and files saved within your computer in isolation from one another. For computers with at least one Linux distribution, /boot is commonly one of these partitions. Most refer to it as the Linux boot partition.

boot partition in linux

We use the Linux boot partition, as its name directly implicates, during our system’s booting phase. It contains files to select and load the desired operating system among the available ones within your computer. The most important files for booting up a Linux distribution contained in the Linux boot partition are ‘vmlinuz’ (the kernel image) and ‘initrd.img’ (which creates a root system in memory during the booting phase).

The boot partition also includes the bootloader, the software that boots the computer and loads the necessary kernel. Since v3.30 of Linux, users can now load new Linux kernels without any bootloader, albeit without the ability to use certain features, such as mouse support.

Say that you want all features included when you boot up; there are bootloaders such as the ‘GRUB’ or ‘ELILO.’ Although they serve the same purpose, they can drastically differ from one another in some aspects.

The Origins of the Linux Boot Partition

To better understand how it is currently used, it’s best that we first dive into the origins of the Linux boot partition and its historical relevance.

In the first generation of computers, there was much less flexibility in the BIOS firmware used during the booting phase. Compared to what we have now, the BIOS back then was like birds in a cage. The firmware restricted access exclusively to the first 1024 sectors of storage in the installed hard drive. Booting an operating system from a partition located after that is impossible.

old linux boot partition

The Linux boot partition was created at the beginning of the storage, where the BIOS firmware could reach it to kickstart the Linux kernel. After booting it up, the restriction was no longer significant – it allowed us to have operating systems anywhere within the hard drive.

The Linux boot partition was the answer to the strict limitations set by the first computers. For the first Linux systems with multiple distributions, the Linux boot partition was a crucial partition containing essentially everything needed to boot up any operating systems the computer may have.

Advantages and Disadvantages of Linux Boot Partition

Advantages

There are several advantages to using a Linux Boot partition. Here are some of them:

  • Reduces the complexity of the file system – the Linux boot partition separates the operating system from the bootloader, making the file system less complex. Each partition also contains tables capable of storing files, descriptors, etc.
  • Optimizes the computer’s performance – the Linux boot partition is usually small, only a couple of hundred megabytes. It ensures small tables are working at their best, thus, optimizing your computer’s overall performance.
  • It can be an interesting approach for more complex setups – the initial RAM disk requirements are also small, making it an interesting approach for more complex setups. It is worth noting that there are more possibilities when the Linux boot partition is a standalone partition, such as exotic file systems or encrypted partitions. These setups are otherwise impossible without a Linux boot partition.

Disadvantages

As with everything in this world, when there are advantages, there will always be disadvantages. The Linux boot partition is no different. Here are some of them:

  • It can grow and reach the storage limit whenever you upgrade the kernel – since the Linux boot partition also contains the kernel, whenever you upgrade it, you risk the partition growing in size and eventually reaching its storage limit. While you may remove old kernels and even automate the bootloader to deal with the problem automatically, nobody wants to deal with that nuisance constantly.
  • Modern computers no longer rely on BIOS firmware – the common computers today don’t rely on the old BIOS firmware anymore. Nowadays, most systems incorporate the UEFI firmware, which inherently doesn’t have the restriction of the 1024 sectors of storage we mentioned above. Say that we only have a single operating system installed; creating a Linux boot partition might be overcomplicating things.

Do You Need a Boot Partition in Linux?

To answer straight, using a Linux boot partition isn’t necessary; you can go without it. However, there are some cases where having it is optimal.

Most computers only have a single operating system installed within them. As long as the hardware is recent – perhaps newer than the models from the 2000s – there is no need to create a Linux boot partition. Newer computers no longer have the old restrictions that brought forth the creation of boot partitions.

That being said, there are still certain situations where creating a Linux boot partition can be essential. One instance is when the bootloader can no longer read or access the file system that stores the operating system itself.

Moreover, you can also dispel one of the disadvantages we mentioned above by creating a partition with enough space. You can choose to have your Linux boot partition between 150MB and 500MB. While small by today’s storage standards, that size is already enough to accommodate multiple kernel upgrades without deleting the older, unused ones.

A Linux boot partition can help you and your system in certain situations. Here are some of them:

●      Boot Partition for New, Unsupported File systems

There are various Linux file system types (e.g., EXT4, ZFS, BTRFS) available that we can utilize to format our partitions. Some file systems cannot store the root directory and boot files together. However, we might prefer one format over the other for certain reasons. We can have a boot partition with a classical file system type, ext2fs. It can load partitions containing newer file systems, such as "ZFS" and "ext4."

●      Boot Partition for Encrypted File systems

Usually, computers cannot start from an encrypted partition. It is true not only for Linux systems but also for Windows. For instance, if the full-volume encryption of BitLocker is in use, it will automatically create an extra partition it will use for the booting phase.

If we want to encrypt the files system of one of the operating systems currently installed in our Linux system, we would have to create a Linux boot partition. We would need to store the kernel, ‘initrd,’ and bootloader in one unencrypted boot partition and configure it to mount encrypted partitions. Doing this would allow you to have encrypted file systems that you can manage from an unencrypted partition.

●      Boot Partition for Logical Volume Management (LVM)

Depending on the Linux distribution, you may see an available Linux boot partition that you may still use. It is the case for several enterprise distributions, such as SUSE Linux Enterprise and Red Hat Enterprise Linux. These distributions need this split because they use Logical Volume Management (LVM). Note that common bootloaders cannot handle LVM, so if we use distributions with LVM, we must have a Linux boot partition.

Furthermore, the number of advantages you can get out of LVMs over common partitioning usually surpasses the disadvantages of having a completely separate boot partition.

●      Boot Partition as a Fail-Safe

Suppose you have a dual-boot system; having the Linux boot partition as a standalone file system prevents you from deleting the bootloader accidentally. If you store the bootloader in the same partition as one of the OSs in your computer and delete that partition, you will make the system unbootable. If you have a Linux boot partition, you can safely delete any operating system and keep the remaining undisturbed.

What's the Recommended Size for Linux Boot Partition?

Take note that a Linux boot partition can be any size. However, it is recommended that you keep your boot partition size small but large enough to accommodate several instances of a kernel upgrade.

We usually keep it between 17 and 25MB because it only contains the Linux kernel and its boot time files. Variable files, web pages, logs, and FTP files are contained within the /var partition. You wouldn’t want to sacrifice a sizeable chunk of your hard drive just for a Linux boot partition.

How To Check the Boot Partition in Your Linux

Here is how you find the Linux boot partition:

Step 1. Launch the Terminal app or use the SSH command to connect to your system’s remote server.
finding linux boot partition

Step 2. There, run the following commands below. Note that you need to be the root user to run them.

$ Isblk

or

$ Isblk –I

or

$ Isblk /dev/sda

finding linux boot partition lsblk command

Step 3. On Linux, you should see the following line (/boot or BOOT) indicating the information about the boot device.

After that, find the Linux boot partition using the fdisk command:

# fdisk –I

or

# fdisk –I /dev/sda

finding linux boot partition fdisk command

Step 4. You should find this information on the line beginning with Device Boot and marked with a * symbol.

Lastly, find the boot partition using the following command:

# sfdisk –I

or

# sfdisk –I /dev/sda

finding linux boot partition sfdisk command

How To Set/Change Boot Partition in Linux?

Here is how you change Linux boot partitions:

Step 1. Create a file system on the backup drive (it should be a bigger drive).

Take, for instance, creating partition sdb1 and file system:

creating file system on backup drive

Step 2. Configure the boot flag on /dev/sdb1.

Double-check if the bootable flag on the new boot device sdb1 is set.

configuring boot flag

Step 3. Now transfer the boot files from the /boot directory to the larger secondary block device (sdb1).

Mount the new larger secondary block device in a directory, i.e., boot1. Copy all the files from the /boot folder to the /boot1 folder.

transferring boot files to secondary block device

Step 4. Update the device.map file with the newly created device entry from the new block device (/boot1/grub/device.map).

Since it is the secondary hard drive, it should be referred to as hd1, while the first drive would promptly be referred to as hd0; map it to /dev/sdb.

updating device.map file

Step 5. Modify now the grub.conf file to point to the new block device.

Change the root device from root (hd0,0) in the grub.conf file on the new block device (/boot1/grub/grub.conf).

Change also the splashimage line to splashimage=(hd1,0)/grub/splash.xpm.gz.

modifying the grub.conf file

Step 6. Now install grub on the new block device.

To install it on the secondary hard drive (/dev/sdb), run the grub command with the mapped device and the optional argument.

installing grub on new block device

Step 7. Update /etc/fstab with sdb’ information.

Add the /dev/sdb1/ UUID to the /etc/fstab file, commenting on or removing the previous boot device entry.

removing previous boot device entry

Step 8. After the process, finish by rebooting and testing.
rebooting and testing

How To Delete a Boot Partition in Linux?

Here is how you delete a Linux boot partition:

Step 1. Before deleting a partition, run the command fdisk -l to list the partition scheme.

Determine the partition number you wish to delete and remember it.

listing the partition scheme

Step 2. Choose the disk you want to remove. Execute the following command to select a disk:

sudo fdisk /dev/sdb

selecting the disk with the partition

Step 3. Make a back of your data first before deleting any partition.

Remember that all data is automatically deleted when a partition is deleted. To delete your selected partition, run the d command in the fdisk command-line utility.

deleting the selected partition

Step 4. Reload the partition table to ensure that the partition you wish to delete successfully gets removed.

Run the p command to check.

confirming that the partition is deleted

Step 5. After verifying the partition is deleted, run the w command to write and save changes made to your hard disk.
saving the changes

How To Recover Deleted Boot Partition in Linux?

If you accidentally delete a Linux boot partition, don’t worry about it. There is still a chance for you to recover it. It is because the data is not erased when you accidentally delete a partition. Instead, the partition is exiled from the partition table. The data stored within the accidentally deleted partition is still in your drive, but the operating system no longer has access.

There are several ways you can recover a deleted Linux boot partition, one of them is by using useful tools available on the internet that are designed to recover lost partitions, such as the Wondershare Recoverit.

repairit

Wondershare Recoverit – Almighty Linux Data Recovery Software

Efficiently handle 500+ Linux data loss scenarios, including disk formatting, OS failure, lost partition, power failures, virus attacks, etc.

Support 600+ active Linux distros such as Ubuntu, Linux Mint, Debian, Fedora, etc.

Recover lost or deleted partitions, photos, videos, music, emails, and other 1000+ file types effectively, safely and completely.

The simple point-and-click interface allows you recover data from Linux hard drives in just a few clicks.

Here is how you recover deleted Linux boot partitions using Wondershare Recoverit:

Prerequisite: a workable Windows PC or Mac.

Step 1. Select Linux Recovery

Launch Recoverit after the installation on your Windows or Mac computer. Then, click Linux Recovery from the NAS and Linux section.

select linux recovery

Step 2. Connect to the Linux

Enter the information of your Linux to create a connection between the Linux device and the software and click Connect.

connect linux computer

Step 3. Scan for Deleted Partition

After the connection is successful, Recoverit will start scanning any missing data in the Linux automatically.

scan the linux computer

Step 4. Preview and Recover

The scanned files will list on the screen. You can preview the files to make sure they are the files you want. Finally, click the Recover button to save them to a safe location.

recover deleted linux data

Conclusion

That is everything you need to know about Linux boot partitions, boot partition sizes, changing boot partitions, etc. While only a few utilize them nowadays, they still have advantages. Before performing any partitioning, it's a good idea to back up your files using Wondershare Recoverit.

You May Also Like