1. Overview
In this article, we’ll talk about the /boot partition in Linux systems. We’ll discuss what the partition is, its origins, the advantages and drawbacks of using it, whether it is necessary, and when we might need it.
2. What Is the /boot Partition?
Most computer systems have their storage split into smaller units known as partitions. Partitions serve to organize the files and contents of the computer in isolation from each other. For systems that contain at least one Linux distribution, /boot is commonly one of these partitions.
As the name indicates, we use the /boot partition during the booting phase. It contains files that serve to select and load the desired operating system among the available ones. The most important files for starting up a Linux distribution contained in the /boot partition are vmlinu**z (which is the kernel image) and initrd.img (which creates a root system in memory during startup).
The /boot partition also contains the bootloader, which is the software that boots a computer and loads the kernel. We can load new Linux kernels (since v3.3.0) without any bootloader if we don’t need features such as mouse support. When we require extra features, we have bootloaders such as GRUB (which is one of the most well-known) or ELILO (which evolved from its legacy counterpart LILO). There are differences between them, but they serve a similar function.
3. Historical Relevance
Before discussing its current use, let’s discover the origins of the /boot partition. In the first computers, there was a limitation in the BIOS firmware used during start-up. The firmware restricted access exclusively to the first 1024 sectors of storage in the hard drive. Thus, it was impossible to boot an operating system from a partition located after that.
The /boot partition was created at the beginning of the storage, where the BIOS firmware could reach to start the Linux kernel. After loading it, the restriction was no longer meaningful. Thus, we could have operating systems anywhere on the hard drive. For the first Linux systems with multiple distributions, the /boot partition was an essential partition that contained everything needed to load any of the operating systems.
4. Advantages of the /boot Partition
There are some advantages when using the /boot partition. When it’s at the beginning of the hard drive, the start-up phase is optimal. We can reduce the complexity of the file system because the operating system and bootloader are located in different places. Each partition contains tables that store files, descriptors, and so on.
The /boot partition is usually small, a couple of hundred megabytes being enough. This ensures small tables with optimized performance.
Moreover, the initial RAM disk requirements are smaller, making it an interesting approach if our setup is complex. There are more possibilities when /boot is a standalone partition, such as encrypted partitions or exotic filesystems. All these setups are simply impossible if we don’t have a /boot partition.
5. Disadvantages of the /boot Partition
There are also some drawbacks when we choose to create the /boot partition. As mentioned, the /boot partition contains the kernel. If we upgrade it, the /boot partition can grow and reach the storage limit, which is usually set up to be relatively small. We can certainly remove old kernels and even automate the bootloader to delete them. However, we can completely avoid this nuisance by storing the bootloader and operating system in /.
Nowadays, modern computers don’t rely on the old BIOS firmware and have UEFI firmware that doesn’t have the restriction of the 1024 sectors of storage. If we only have a single operating system installed, creating a /boot partition might be overcomplicating the system administration.
6. Is the /boot Partition Necessary?
After the previous discussion, we can now ask whether we need the /boot partition in our system.
We definitely don’t need the /boot partition in every case. In the general case, if we have a single operating system, there’s no need to create the /boot partition as long as our hardware is recent (newer than 2000 or so). New machines don’t have the old restrictions that required the creation of the /boot partition.
However, the /boot partition can turn out to be essential depending on our setup. We need the partition when the bootloader can’t read/access the filesystem that stores the operating system.
Finally, we can avoid one of the disadvantages mentioned before by creating a partition with enough space. If we end up choosing to have the /boot partition, b****etween 150MB and 500MB should be enough. This is small in today terms of storage. However, it’s still enough to accommodate multiple kernel upgrades without needing to remove old, unused kernels.
6.1. /boot Partition for Encrypted Filesystems
Computers usually cannot start from an encrypted partition. This is true not only for Linux but also for Windows. For example, if the full volume encryption of BitLocker is in use, it will create an extra partition for booting.
Thus, if we want to encrypt the filesystem of one of the operating systems of our system, we will need to create the /boot partition. We should store the kernel, initrd, and bootloader in the unencrypted /boot partition and configure it to mount encrypted partitions. This way, we can have encrypted filesystems that we manage from an unencrypted partition.
6.2. /boot Partition for New, Unsupported Filesystems
There are multiple filesystem types available that we can use to format our partitions. Some filesystems types don’t support storing the root directory and /boot together. However, we might prefer one format over another for some reasons. In that case, we can have a /boot partition with a classical filesystem type (such as ext2fs) that loads partitions with newer filesystem types (such as ext4 or ZFS).
6.3. /boot Partition for Logical Volume Management (LVM)
Depending on our Linux distribution, we might see that there’s a /boot partition available. This is the case for many enterprise distributions such as Red Hat Enterprise Linux and SUSE Linux Enterprise. These distributions need this split because they use Logical Volume Management (LVM). The common bootloaders can’t handle LVM, so if we use distributions with LVM, we need to have a /boot partition.
The number of advantages that LVM provides over common partitioning usually surpasses the drawbacks of having a separate /boot partition.
6.4. /boot Partition as a Fail-Safe
Finally, there is yet another scenario where having a separate /boot partition is useful. If we have a dual-boot, having the /boot partition as a standalone filesystem will prevent us from accidentally deleting the bootloader. If we store the bootloader in the same partition as one of the operating systems and we delete that partition, we will make the system unbootable.
However, if we have the /boot partition, we can delete any operating system and keep the remaining one(s) unaffected.
7. Conclusion
In this article, we’ve talked about the /boot partition in depth.
When we configure a new system, we need to choose whether to create this partition or not.
As discussed, this choice largely depends on the setup requirements of our system.