Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Aug 29 '11 at 18:25

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 10 down vote accepted

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

share|improve this answer
7  
Instead of all that dd dance, just use file -s /dev/sda. –  CesarB Aug 29 '11 at 19:46

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.

share|improve this answer
    
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

 
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.