7

I remembered reading one question how would you back up the MBR of a disk.

Two of the choices are

dd if=/dev/sda of=/dev/sdb bs=512 count=1
dd if=/dev/sda of=/dev/sdb bs=440 count=1

and the correct answer is

dd if=/dev/sda of=/dev/sdb bs=440 count=1

I am confused. Is the MBR size 440B or 512B ?

1
  • Looks like someone else was taking Linux+ :) Jan 16, 2019 at 17:23

3 Answers 3

10

The MBR (Master Boot Record) is 512 bytes.

  1. 446 bytes Bootloader
  2. 64 bytes (4 * 16 bytes) Partition Tables
  3. 2 bytes Magic Number which is AA55H

However these values are for generic MBR, you can see other MBR structures from: https://en.wikipedia.org/wiki/Master_boot_record

Anyway you have to backup hole 512 bytes of MBR with dd (disk-to-disk) command.

3
  • Is it 446 or 440B of Boot loader ?
    – Kenny
    Jan 12, 2016 at 14:50
  • 2
    @Kenny, It's 446 not 440 Bytes... Please check the given link or do simple math... 440 + 64 + 2 != 512 Jan 12, 2016 at 19:55
  • 1
    @Kenny The 446B area is reserved for the bootloader but some OS’s might also use a part of this area for something else if they fit the bootloader into a smaller space. For example in Windows, “the 4 bytes following the first 440 bytes contain the Windows Unique Disk Signature” (see superuser.com/a/533079/84807).
    – Melebius
    Feb 20, 2019 at 9:29
7

The MBR IS 512 bytes. So the first example is how you would back it up. The partition table is at the end, in the area after 440 bytes in - so, if you wanted to back it up WITHOUT the partition table, then you could use the second example (why you'd want that, I don't know).

1
  • 2
    The area before the partition table is basically the boot code of the mbr, so if you want to run this code on another disk with a different partition table then you can copy just that.
    – Rolf
    Apr 21, 2018 at 22:51
1

Max size of MBR is 512 bytes. Back to old days MBR was used to load kernel into memory and to bootstrap it. Nowadays MBR used to bootstrap bootloaders, then bootloaders bootstraping kernel.

More about MBR you can find in wikipedia or osdev wiki.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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