Ubuntu: Questions about MBR/GRUB


I have a simple question. Where is MBR (GRUB) located, it's inside a partition? And does it get removed when you format & delete the partitions of Ubuntu?


Where is MBR (GRUB) located, it's inside a partition?

No, it's not located inside a partition. MBR (Master Boot Record) is the first sector of a disk, so it is 512 bytes on a 512 bytes-sectored disk.

Just to note, the first sector of a partition is actually called Partition Boot Record or Volume Boot Record.

does it get removed when you format & delete the partitions of Ubuntu?

No, MBR is not removed when you delete partitions as it is located outside the partition range, the partition table would be updated accordingly though in such operation(s).


This question isn't quite as simple as you may think.

First off, MBR and GRUB aren't the same thing. MBR is:

the information in the first sector of any hard disk or diskette that identifies how and where an operating system is located so that it can be boot (loaded) into the computer's main storage or random access memory. The Master Boot Record is also sometimes called the "partition sector" or the "master partition table" because it includes a table that locates each partition that the hard disk has been formatted into. In addition to this table, the MBR also includes a program that reads the boot sector record of the partition containing the operating system to be booted into RAM. In turn, that record contains a program that loads the rest of the operating system into RAM.

GRUB, however, is:

a boot loader package from the GNU Project. GRUB is the reference implementation of the Free Software Foundation's Multiboot Specification, which provides a user the choice to boot one of multiple operating systems installed on a computer or select a specific kernel configuration available on a particular operating system's partitions.

A shorter version: MBR is the info on a hard drive that tells the BIOS of the computer what to boot. GRUB is a bootloader, which scans for installed operating systems and presents them in a list to choose among. (Not the best summary, but it should do for now)

Where is MBR (GRUB) located, it's inside a partition?

Well, it depends. You see, there are actually at least two different ways a hard drive might be set up:

  • MBR

    This was explained above, so I think I can leave it at that.

  • GPT

    This is a newer standard than MBR, although it essentially does the same thing. GPT has more features and is generally more useful than MBR. However, for normal purposes, the two aren't vastly different.

(For a more in-depth explanation of the differences: http://www.howtogeek.com/193669/whats-the-difference-between-gpt-and-mbr-when-partitioning-a-drive/)

There is one difference that is very important to your question, though, and that is (U)EFI. Hard drives using GPT are compatible with EFI. MBR is not, at least not normally.

UEFI presents itself in the form of a small FAT32 partition at the very beginning of the hard drive. Inside this, operating systems that support GPT/EFI place their boot files. If the system the hard drive is on is compatible with EFI, it will first look into that EFI partition and find a boot file to load an OS. There's some sort of priority system that decides what file to boot from if there are multiple options, but I don't really know how that works.

MBR does not make use of this EFI partition. Instead, OS boot files are stored in their respective partitions, and the MBR tells the BIOS what to look for. In the case of GRUB, the normal MBR code gets replaced by the stage 1 portion of GRUB. This then passes off to the stage 1.5 part, which then passes off to stage 2. Stage 2 is the only part of the process on the partition.

This configuration is very different on Windows, but we're not here to talk about Windows.

So, finally, the answer. With both MBR and GPT, deleting just the Ubuntu partition is a bad idea. In both cases, important configurations for GRUB are stored in the respective OS partitions, while most (MBR) or all (GPT) of the actual bootloader is at the very beginning of the hard drive.

Deleting the Ubuntu partition won't delete GRUB, and will instead cause grub rescue to come up instead. This is why there are so many questions about removing Ubuntu and keeping Windows or removing Ubuntu and installing Windows: GRUB doesn't like to let go of the drive.

This leads me to the second part of your question:

And does it get removed when you format & delete the partitions of Ubuntu?

Through the power of editing and lack of memory, I seem to have answered this above.

You seem to have a bit of a misunderstanding about what MBR is and what GRUB is. Hopefully, I've fixed that and answered your question as well.


With my understanding of MBR & Grub this is sort of a multipart answer. If I'm wrong, please correct me.

The MBR itself exists in 512 bytes of the 1st sector (Sector 0) of a hard drive, outside a partition space. The MBR is loaded with the boot.img file, and the boot.img file's only function is to load core.img.

The core.img exists in the next 32k of disk space (between sector's 1-63). This also exists outside a partitioned area. The core.img is made up of the diskboot.img (depending on the boot method), kernel.img, and the video & file system modules required to display messages & mount the /boot partition. The core.img mounts the /boot partition & read's the grub.cfg & starts the GRUB menu system.

So with my understanding you wouldn't delete Grub itself by removing the /boot partition but the *.cfg file core.img use's to start it.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »