I have a USB stick supposed to be bootable, but the computer does not boot it. I suspect that there is no MBR (Master Boot Record).

How do I test if this is so, preferably from command line in Linux.


You can inspect this with dd and file, e.g. for /dev/sda:

root@rapunzel:~# dd if=/dev/sda of=/tmp/test count=1 bs=512
1+0 records in
1+0 records out
512 bytes (512 B) copied, 6.1994e-05 s, 8.3 MB/s

Then you've got the bootsector in /tmp/test you can ask file what it thinks:

root@rapunzel:~# file /tmp/test
/tmp/test: x86 boot sector; partition 1: ID=0x7, starthead 32, startsector 2048, 1850621692 sectors; partition 2: ID=0x17, starthead 254, startsector 2922062850, 8209215 sectors; partition 3: ID=0xfd, starthead 254, startsector 1850623740, 1071439110 sectors, code offset 0x63, OEM-ID "      м", Bytes/sector 190, sectors/cluster 124, reserved sectors 191, FATs 6, root entries 185, sectors 64514 (volumes <=32 MB) , Media descriptor 0xf3, sectors/FAT 20644, heads 6, hidden sectors 309755, sectors 2147991229 (volumes > 32 MB) , physical drive 0x7e, dos < 4.0 BootSector (0x0)

You can also inspect the file manually with hexdump -C

  • 33
    Instead of all that dd dance, just use file -s /dev/sda. – CesarB Aug 29 '11 at 19:46
  • What if it says /dev/sdb1: x86 boot sector but nothing else? In my case it won't boot ... – Raketenolli Mar 10 '18 at 14:50
  • Could be gpt or corrupted disk or a sample taken with DD that's too short. Maybe you can get lucky and guess what the partition table is meant to be, but I hope you've got a backup. – Flexo Mar 10 '18 at 17:16
  • I took 2048 bytes as well, same result. The thumb drive is probably simply not made for booting. I'll use a different one which has proven to work in the past. – Raketenolli Mar 10 '18 at 17:32
  • dd-ing an image to a USB drive in my case required of=/dev/sdb. It did not work with /dev/sdb1. – Raketenolli Mar 11 '18 at 0:17

since CesarB didn't post his comment as an answer:

jcomeau@aspire:~$ sudo file -s /dev/sdb
[sudo] password for jcomeau: 
/dev/sdb: DOS floppy 1440k, DOS/MBR hard disk boot sector

You can use TestDisk (free, open source, and cross platform) to do this. It can scan any drive you want, and analyze the partition layout (or you can specify it and it will try to search for partitions in the layout style you choose). TestDisk can also overwrite the MBR on a disk with the one you choose.

  • TestDisk seems very helpful. However, I did not find a way of just collecting information with it, and not be on the way to recover/repair something. – Mads Skjern Sep 1 '11 at 8:36

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.