Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


===MBR INFO===
code area                   440(max. 446)
disk signature (optional)   4
Usually nulls; 0x0000       2
Table of primary partitions 64(Four 16-byte entries, IBM partition table scheme)
MBR signature;0xAA55        2

MBR, total size: 446 + 64 + 2 = 512

I believe the dd command to copy JUST 64 byte partition table would be:

dd obs=2 seek=223 count=32 if=/path/to/some_mbr.bin of=/dev/sda

Is this correct,

and/or is there a better way?

share|improve this question
There might be a slight confusion with the question - you don't exclusively state, whether you want to make a backup of the MBR or actually restore it. Supposedly the latter, as you are using seek and a .bin file for if – XXL Jan 9 '12 at 17:11

If some_mbr.bin is a full mbr, you need to skip the code in the input file too.

dd bs=1 if=/path/to/some_mbr.bin of=/dev/sda skip=446 seek=446 count=64

Of course you could do that also with vi -b /path/to/some_mbr.bin /dev/sda with yank and put (if you dare).

share|improve this answer

Did you try it? I just did and the output file was 16KB, not 64 bytes (try looking at the man page you linked to and the values of obs and ibs).

Try setting the blocksize (both for read and write) to 2, and skip reading the input you don't want rather than reading it all and only writing what you want.

So you'd end up with something along the lines of:

dd bs=2 skip=223 count=32 if=/path/to/some_mbr.bin of=/dev/sda

It would also be easier to read if you had a blocksize of 1 rather than 2 and mean no more doubling and halving numbers in your head.

I'd try reading the mbr and writing it to a file and checking with a hex viewer before I was brave enough to write to the mbr though.

share|improve this answer

Your Answer


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.