If you open a partitioning tool and point it at your hard drive, you will almost certainly see a small boot partition before everything else. The boot partition stores the bootloader and allows your computer to boot the installed operating system. It may only consume a small portion of your hard disk drive and remain invisible when actively using the computer.
However, as a Linux user, you may wonder: Is the boot partition in Linux necessary? How can you find or mount a boot partition in Linux? How to Change it? How to resize or extend it? Continue reading to find out the answers to these questions.
In this article
Part 1: What Is Boot Partition in Linux?
The boot partition, typically found in older Linux installations and hidden from view, contains the fundamentals required to boot the operating system. When your computer boots up, it will look in the boot partition for the files needed to load the operating system.
Part 2: How Is the Linux Boot Partition Used?
Depending on the operating system, there are two approaches to using the boot partition.
The boot partition in Linux contains files such as the kernel, which is the operating system's beating heart and brain. It even includes "Linux initial RAM disk (initrd)," which executes a temporary root system in the computer's memory. It also has GRUB, the bootloader that performs the operating system.
Previously, the boot partition and system partition were separate. The first held everything required to load the operating system, and the second contained the operating system itself. It provided flexibility, especially when running multiple operating systems concurrently. You can also create a separate home partition for your files for the same reason.
The boot partition was created primarily to prevent limitations in older BIOS that could only access the first 1024 sectors of the hard drive. The boot partition functioned as an extension as it was challenging to fit all needed to boot a modern operating system in a small space.
Newer BIOS and their replacement, UEFI, do not have this limitation. Furthermore, most people use a single operating system with their computer, making such partitioning schemes unnecessary. Lately, a single partition contains all needed to load and run the operating system, and it serves as a boot and a system partition.
Part 3: How To Find the Boot Partition in Linux?
1. Find Boot Partition
Use any of the following commands to find the boot partition in Linux:
- The fdisk command is used to manipulate the disk partition table.
- The sfdisk command is a Linux partition table manipulator.
- The lsblk command is used to list block devices.
Step 1. Launch the Terminal app or use the ssh command to connect to the remote server.
Step 2. You must be the root user to run the following commands:
a). Find the Boot Partition Using the lsblk command
Enter the following command:
$ lsblk -l
$ lsblk /dev/sda
On Linux, the following line (/boot or BOOT) indicates information about the boot device:
|-sda1 8:1 1 243M 0 part /boot
b). Find the Boot Partition Using the fdisk Command
Enter the following command:
# fdisk -l
You can find this information on the line beginning with Device Boot and marked with a *. For example, the /dev/sda1 is the boot device or partition on Linux in this example output.
c). Find the Boot Partition Using sfdisk command
Enter the following command:
# sfdisk -l
2. Find Boot Partition and EFI Partition in UEFI Mode
Step 1. To find the boot partition and EFI Partition in UEFI Mode in Linux, enter the following command:
$ test -d /sys/firmware/efi/ && echo efi || echo bios
Step 2. You can use the fdisk or parted command to find the EFI partition.
$ sudo fdisk -lu|grep -i efi
The drive letter is not displayed on the same line as the partition number in Parted, but you can use the full information.
$ sudo parted -ls
Model: WDC WD32 00BEKT-00PVMT0 (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 33.6MB 537MB 503MB fat32 EFI System Partition boot, esp
2 537MB 316GB 315GB ext4
3 316GB 320GB 4161MB linux-swap(v1)
Part 4: How To Mount Boot Partition in Linux?
Step 1. Devices are commonly represented by the names /dev/sda1 /dev/sdb1 or something similar. To determine the device name and the total number of devices currently attached to our system, execute this command to list all partitions:
Step 2. The example has two partitions, /dev/sda1 and /dev/sda2. Mount the /dev/sda2 drive on the /r director to access the data on the /dev/sda2 partition.
- mount command needs 2 arguments
- name of the partition(device/drive) (/dev/sda2 in the example)
- name of the directory where you want to mount the partition (this directory is known as the mount point )
- syntax of mount command:-
- mount partiton_name mount_point
You can now access data from the /dev/sda2 partition by navigating to the directory where we mounted the /dev/sda2 drive.
Part 5: How To Change Boot Partition in Linux?
Step 1. Create a file system on the backup drive (bigger drive). For example, create partition sdb1 and file system:
Step 2. Configure the boot flag on /dev/sdb1. Check that the bootable flag on the new boot device sdb1 is set:
Step 3. 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 (for example, boot1) and then copy all the files from the '/boot' folder to the '/boot1' folder.
Step 4. Update the device.map file with the new device entry from the new block device (/boot1/grub/device.map). Because it is the secondary hard drive, it should be referred to as "hd1" (as device references always begin with 0 (zero), as the first drive would be referred to as "hd0," the second drive as "hd1," and so on), so it should be mapped to "/dev/sdb."
Step 5. Modify the grub.conf file to point to the new block device. Change the root device from "root (hd0,0)" to "root(hd1,0)" in the "grub.conf" file on the new block device (/boot1/grub/grub.conf). Also, change the "splashimage" line to read "splashimage=(hd1,0)/grub/splash.xpm.gz."
Step 6. Install grub on the new block device. To install GRUB on the secondary hard drive (/dev/sdb), run the "grub" command with the mapped device and the optional argument.
Step 7. Update /etc/fstab with sdb1 information. Add the "/dev/sdb1" UUID to the "/etc/fstab" file, commenting on or removing the previous boot device entry.
Step 8. Finish by rebooting and testing.
Part 6: How To Resize (Extend/Shrink) Boot Partition in Linux?
You can use the fdisk utility to resize primary partitions and extend non-lvm root partitions like you can with the parted command. Here is a video tutorial on resizing (extending/shrinking) the boot partition in Linux for more detailed instructions.
Step 1. List the available partitions before resizing the primary partition.
As you can see, the size of the existing root partition /dev/sda2 is 10G. Using unallocated disk space from /dev/sda, we will expand the partition by +1GB.
Step 2. Remove the swap partition. As we need the root to be the last partition in /dev/sda, we must first delete the swap partition before changing the size of the partition.
So, before we disable the swap partition, we will turn it off.
It is now time to use the fdisk utility to resize the partition.
Part 7: How To Recover Deleted Boot Partition in Linux?
You can recover deleted boot partitions in Linux using the graphical user interface or the command line.
Step 1. You must have the installation media for the distribution on CD or USB flash drive. With this media, boot the machine where GRUB2 is not working. When prompted, select the option to try Ubuntu rather than install it. Open the terminal window by pressing Ctrl+Alt+T on the keyboard once the live desktop runs. Enter the following commands into the terminal window:
sudo add-apt-repository ppa:yannubuntu/boot-repair
Step 2. Enter your sudo password when prompted. When the installation is finished, launch the Boot Repair tool with the following command:
Step 3. When the app launches, select Recommended Repair.
When the boot repair is finished, reboot, and you should be able to use the Linux machine with your data.
Part 8: Do You Still Need a Boot Partition in Linux?
In general, if you only have one operating system, a boot partition is unnecessary as long as you use a newer Linux distribution. This is because the old restrictions that required the creation of the boot partition are no longer present on new machines. The system partition can serve both functions, containing everything needed to load and run your operating system.
However, depending on your setup, the boot partition may become necessary. For example, a boot partition is required when the bootloader cannot read/access the operating system filesystem. In multi-boot configurations, where multiple operating systems are installed on the same hard disk drive, the boot partition is where the initial bootloader is located. When it boots up, you can select which operating system you want to use.
If we decide to have the boot partition, somewhere between 150MB and 500MB should suffice. In terms of storage today, this is small. However, it is sufficient to support multiple kernel upgrades without the need to remove old, unused kernels.
There you have it. We hope we answered your multiple questions regarding boot partition in Linux. Boot partition in Linux is usually unnecessary if you already have current Linux devices. It depends on your situation. Consider downloading Wondershare Recoverit, as it offers numerous rich features to recover your critical data.