2
~$ sudo /sbin/fdisk -l /dev/sda | grep sda[0-9] 
/dev/sda1   *        2048   234133503   117065728   83  Linux
/dev/sda2       234135550   250068991     7966721    5  Extended
/dev/sda5       234135552   250068991     7966720   82  Linux swap / Solaris

~$ cat /sys/block/sda/sda1/start 
2048

~$ sudo hexdump -s 446 -n 64 /dev/sda
00001be 2080 0021 fe83 ffff 0800 0000 9000 0df4
00001ce fe00 ffff fe05 ffff 9ffe 0df4 2002 00f3
00001de 0000 0000 0000 0000 0000 0000 0000 0000
*
00001fe

The last command is meant to dump the MBR. You can see from the second to last int (0800 0000) which is little endian, that it encodes 8. 8*512=4098 which is not the 2048 reported by the two other commands. Why is that different?

2

The number 0800 in hexadecimal form converts to 2048 in decimal form.

The command to convert a hexadecimal number to decimal is:

echo "ibase=16; hex-number"|bc

Running the command:

echo "ibase=16; 0800"|bc

Returns the result: 2048

1
  • haha, wow i feel dumb. i was inverting the nibbles, not just the bytes. – chacham15 Dec 25 '13 at 4:46

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.