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.

How would i do a hexdump in Ubuntu for the first track of a HDD?

I am looking for a winhex-esque output if that makes sense. The first track has 63 sectors, each 512 bytes long. I tried

dd if=/dev/sda bs=1 count=512 | hexdump -C

but that only gave me what appears to be the MBR, or first sector of the HDD. I guess i am confused about what bs and count should be. Bs means how many bytes to display and count is how many multiples of bs? Thanks!

share|improve this question
    
If i try bs-1 count=32256, it appears to truncate the output to only about two pages worth of scrolling within the terminal... i have no idea why. –  Daniel Gratz Jun 29 '11 at 15:32

1 Answer 1

bs is the block size, in bytes, and count is the number of those blocks to grab. So the command you actually want to dump the first track is:

dd if=/dev/sda bs=512 count=63 | hexdump -C

The dd man page might be of help.

share|improve this answer
    
Thanks. Any idea why i'm not seeing the full output? I don't even see the 1st block (MBR) when i type the above command. It shows me output only between 000050d0 and 00007e00. –  Daniel Gratz Jun 29 '11 at 15:34
    
Would hexdump -C -n 32256 /dev/sda not work? –  RedGrittyBrick Jun 29 '11 at 16:13
2  
Yes, you think that you're using an interactive hexediting program, as on Windows. You're using a non-interactive program that just dumps everything in one long stream of output, only the last N lines of which are left on your terminal at the end. The next Unix building block for you to learn is the more (or less) command. (-: –  JdeBP Jun 29 '11 at 16:13
    
When I finish overwriting my USB stick, I can test this, but couldn't you try to dump it into a file to browse through. Wouldn't dd if=/dev/sda bs=512 count=63 | hexdump -C > firsttrack.txt output it to a file? –  Rob Sep 13 '11 at 16:29

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.