≡ Menu

How to check boot path (partition) in Linux

How do I identify the boot device or boot path in Linux operating system?

You can find the boot device or boot path in Linux using any one of the following command:

  1. fdisk command – manipulate disk partition table
  2. sfdisk command – partition table manipulator for Linux.
  3. lsblk command – list block devices.

Open the terminal app or login to the remote server using ssh command. You must be root user.

How to use lsblk to display boot partition

Simply type the following command:
$ lsblk
OR
$ lsblk -l
OR
$ lsblk /dev/sda
Sample outputs:

Linux lsblk command show boot device name

Fig.01: Linux lsblk command show boot device name


The following line (/boot or BOOT) indicates the information about my boot device on Linux:

|-sda1   8:1    1   243M  0 part /boot

How to use fdisk command to display boot partition

Type the following command:
# fdisk -l
# fdisk -l /dev/sda

Sample outputs:

Fig.02: Linux fdisk command show boot device name

Fig.02: Linux fdisk command show boot device name


You will find this information at the line starting with Device Boot and marked with *. In this example output, my /dev/sda1 is boot device or partition on Linux.

How to use sfdisk command to display boot partition

Type the following command:
# sfdisk -l
# sfdisk -l /dev/sda

Sample outputs:

Fig.03: Linux use sfdisk command show boot device name

Fig.03: Linux use sfdisk command show boot device name

A note about multiple devices (HDD/RAID)

If you’ve multiple hard drives or Linux software raid, it is going to be hard to find out this information. Consider the following:
# fdisk -l | grep '^Disk /dev'
Sample outputs:

Disk /dev/sdd: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk /dev/sde: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk /dev/md2: 1.5 TiB, 1610636328960 bytes, 3145774080 sectors
Disk /dev/md1: 1.5 GiB, 1602748416 bytes, 3130368 sectors
Disk /dev/md0: 120 GiB, 128877330432 bytes, 251713536 sectors
Disk /dev/md3: 600 GiB, 644257677312 bytes, 1258315776 sectors
Disk /dev/sdf: 492 MiB, 515899392 bytes, 1007616 sectors
Disk /dev/mapper/securebackup: 600 GiB, 644256104448 bytes, 1258312704 sectors
Disk /dev/mapper/cryptvg-mybackup: 600 GiB, 644253483008 bytes, 1258307584 sectors

I’ve multiple disk installed and Linux software RAID devices too. Here is a quick way to find out boot path or partition:

fdisk -l | grep '^/dev/[a-z]*[0-9]' | awk '$2 == "*"'
## OR ##
fdisk -l | grep '^/dev/[a-z]*[0-9]' | awk '$2 == "*" { print $0}'

Sample outputs:

/dev/sdf1  *       62 1006879 1006818 491.6M 83 Linux

/dev/sdf1 is my boot path and to verify the same:
# fdisk -l /dev/sdf
Sample outputs:

 
Disk /dev/sdf: 492 MiB, 515899392 bytes, 1007616 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000e31b0
 
Device     Boot Start     End Sectors   Size Id Type
/dev/sdf1  *       62 1006879 1006818 491.6M 83 Linux
Share this tutorial on:

{ 5 comments… add one }
  • nyu January 6, 2016, 8:56 am

    my test on debian, that lsblk -l doesn’t show any boot information, there is no mount point at /boot

    • John Donovan January 8, 2016, 2:56 pm

      You don’t provide how you ran the command, but I think you ran it as your regular user account; use sudo.

  • Vivek Gite January 6, 2016, 10:13 am

    nyu@ What about fdisk command?

  • luvr January 7, 2016, 8:24 am

    If you don’t have a “/boot” mount point, then you haven’t set up a separate boot partition. You will have booted directly off the root file system, “/”, then.

  • c4m4 January 7, 2016, 10:54 am

    you can use “fdisk -l | awk ‘/^\/dev\/[a-z]*[0-9]/ && $2 ~ /\*/'” but from what I know, Linux can boots with boot flags on boot partition.

Leave a Comment


   Tagged with: , , , ,