Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What is the difference between a bootable and non-bootable partition? I know that a user cannot boot a system from a partition marked non-bootable and can from one marked bootable.

I want to know about the underlying differences between these partition flags.

share|improve this question
1  
May be knowing what is linux boot process might help you. ibm.com/developerworks/linux/library/l-linuxboot –  user14039 May 4 '12 at 18:03
    
@anon_anon Uh, that article, while no doubt a good one, is a bit old. It's from 2006 and discusses GRUB Legacy. I think things have change a bit with GRUB 2. (If nothing else, they use different names for the boot "stages" in GRUB 2 :). I tried to locate a DeveloperWorks update of the article you linked for GRUB 2, but did not. Closest I could come was this: Migrate to GRUB 2. –  irrational John May 14 '12 at 23:53
    
@Rony Ooops. Updated my answer. –  irrational John May 15 '12 at 4:17
    
possible duplicate of What is the "Bootable flag" option when installing a distro? –  Gilles Jun 11 '12 at 22:17
add comment

4 Answers 4

Just a flag in the table of partitions. The MBR search the flag in the partitions and run from the partition with the "boot" flag.

share|improve this answer
add comment

I know that a user cannot boot a system from a partition marked non-bootable and can from one marked bootable.

From laptop harddisk

# fdisk  -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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
Disk identifier: 0x47b94fbe

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     1999999      998976   83  Linux
/dev/sda2         2000000     9999999     4000000   82  Linux swap / Solaris
/dev/sda3        10000000    89999999    40000000   83  Linux
/dev/sda4        90000000   976773167   443386584   83  Linux

From bootable USB Linux

# fdisk  -l /dev/sdb

Disk /dev/sdb: 8004 MB, 8004304896 bytes
247 heads, 62 sectors/track, 1020 cylinders, total 15633408 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
Disk identifier: 0x000a5395

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     2097151     1047552   83  Linux
/dev/sdb2         2097152    15632383     6767616   83  Linux

They do not have a single bootable partition, while they are all bootable.

share|improve this answer
add comment

Though it was down voted ... possibly because someone thought it was not answering the question ... I think @Rony's answer is a good start at explaining what the boot flag is about. (I was actually planning to begin my answer with an example similar to the one he provided.)

I was all set to ramble off an answer about how the boot flag is, at this point in time, an often ignored (as @Rony's example shows) historical remnant from a period when hard drives were smaller and bootloaders were much less sophisticated.

But then I discovered this had already been said in this answer to this question: What is the "Bootable flag" option when installing a distro?

What's more there was also a link to a short article about the Boot flag which says

  • "Its primary function is to indicate to a MS-DOS/MS Windows-type boot loader which partition to boot. In some cases it is used by Windows XP/2000 to assign the active partition the letter "C:"."

Well, this is embarrassing ...

When I claimed that the boot flag was a "historical remnant" I was assuming this was the case because clearly GRUB had no need to use it. Surely Microsoft would also have "moved on".

The well known quote usually attributed to Oscar Wilde turned out to be too true in this instance.

It appears that the MBR and PBR (Partition Boot Record) loaders used by the Windows operating systems DO expect the boot flag to be set correctly.

To test this I cleared the boot flag from all the partitions of a Windows 8 VM. (See below. If you're curious, here's a link to the pastebin of the complete BootInfo Script result)

Drive: sda     
Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders, total 52428800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1               2,048       718,847       716,800   7 NTFS / exFAT / HPFS
/dev/sda2             718,848    52,426,751    51,707,904   7 NTFS / exFAT / HPFS

When I cleared the flag from both partitions, I got the error message FATAL: INT18: BOOT FAILURE when I attempted to boot. (I am not sure if that is from the Windows MBR bootloader or the VM's equivalent of a BIOS.)

Just to see what would happen, I also set the boot flag on the "wrong" partition, /dev/sda2 instead of /dev/sda1. Doing that resulted in the window shown in the image below.

Windows failed to start error window

<sigh/>

This experience makes me wonder if Microsoft is still using the same MBR boot sector loader which they used for MS-DOS and Windows 3.0/3.1?

share|improve this answer
add comment

When using the traditional Microsoft MBR, code in the MBR identifies how to do disk I/O and goes through the partitions to see which one is marked with the bootable flag. Only one partition should be so marked. It then checks the first sector of that partition, and if it is marked appropriately, it reads that sector and transfers control to it. If I remember correctly, that check is that the sector ends with 0x55 0xaa.

The rest of the responsibility for booting falls to the code in that sector and the code that it, in turn, loads.

GRUB2 very often uses its own MBR and process, ignoring this bit.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.