How to read MBR (Master Boot Record)
1] What is MBR ?
Master Boot Record (MBR) is the 512-byte boot sector (first sector) of a your a Hard Disk Drive (HDD). MBR contains –
1) Primary Partition table
2) Boot Loader (GRUB/LILO etc)
*** Total Size of MBR is 512 byte and which is divided as shown below…
1) Boot Loader (code) – 446 byte
2) Primary partion table – 64 byte (16 byte * 4)
3) Disk signature & others – 6 byte
4) MBR signature – 2 byte
2] Disk Partitioning – There are two methods/schemes of Disk partitioning
a) MBR Partition Table
b) GUID Partition Table
When a Hard Disk is partitioned with the MBR Partition Table scheme – MBR contains the primary partition entries. Maximum four (4) primary partition or three (3) primary partition and one extended partition can be created. The partition table entries for other secondary partitions are stored in Extended Partition Table. In extended partition, we can create 128 logical partitions.
When a Hard Disk is partitioned with the GUID Partition Table scheme – the Master Boot Record will still contain a partition table, but its only purpose is to indicate the existence of the GUID Table
3] How to read MBR (Master Boot Record)
root@indiangnu:/home/arun# dd if=/dev/sda of=/home/arun/MBR.details bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00014018 s, 3.7 MB/s
root@indiangnu:/home/arun#
root@indiangnu:/home/arun# ls -shl /home/arun/MBR.details
4.0K -rw-r–r– 1 root root 512 2008-09-28 17:57 /home/arun/MBR.details
root@indiangnu:/home/arun#
** The size of file is 512 byte and it is in binary format
command(1) – od
od command dump files in octal or other format
# od [options] file_name
Options
-a select named characters, ignoring high-order bit
-b select octal bytes
-c select ASCII characters or backslash escapes
-i select decimal ints
-x select hexadecimal 2-byte units
** How to convert Binary MBR file data in other format like Hexadecimal format –
arun@indiangnu:~$ od -x /home/arun/MBR.details
0000000 48eb d090 00bc fb7c 0750 1f50 befc 7c1b
0000020 1bbf 5006 b957 01e5 a4f3 bdcb 07be 04b1
0000040 6e38 7c00 7509 8313 10c5 f4e2 18cd f58b
0000060 c683 4910 1974 2c38 f674 b5a0 b407 0203
0000100 00ff 2000 0001 0000 0200 90fa f690 80c2
0000120 0275 80b2 59ea 007c 3100 8ec0 8ed8 bcd0
0000140 2000 a0fb 7c40 ff3c 0274 c288 be52 7d7f
0000160 34e8 f601 80c2 5474 41b4 aabb cd55 5a13
0000200 7252 8149 55fb 75aa a043 7c41 c084 0575
0000220 e183 7401 6637 4c8b be10 7c05 44c6 01ff
0000240 8b66 441e c77c 1004 c700 0244 0001 8966
0000260 085c 44c7 0006 6670 c031 4489 6604 4489
0000300 b40c cd42 7213 bb05 7000 7deb 08b4 13cd
0000320 0a73 c2f6 0f80 ea84 e900 008d 05be c67c
0000340 ff44 6600 c031 f088 6640 4489 3104 88d2
0000360 c1ca 02e2 e888 f488 8940 0844 c031 d088
0000400 e8c0 6602 0489 a166 7c44 3166 66d2 34f7
0000420 5488 660a d231 f766 0474 5488 890b 0c44
0000440 443b 7d08 8a3c 0d54 e2c0 8a06 0a4c c1fe
0000460 d108 6c8a 5a0c 748a bb0b 7000 c38e db31
0000500 01b8 cd02 7213 8c2a 8ec3 4806 607c b91e
0000520 0100 db8e f631 ff31 f3fc 1fa5 ff61 4226
0000540 be7c 7d85 40e8 eb00 be0e 7d8a 38e8 eb00
0000560 be06 7d94 30e8 be00 7d99 2ae8 eb00 47fe
0000600 5552 2042 4700 6f65 006d 6148 6472 4420
0000620 7369 006b 6552 6461 2000 7245 6f72 0072
0000640 01bb b400 cd0e ac10 003c f475 00c3 0000
0000660 0000 0000 0000 0000 a328 228b 0000 0180
0000700 0001 fe07 ffff 003f 0000 1637 0271 0000
0000720 ffc1 fe07 ffff 1676 0271 0d7a 0177 fe00
0000740 ffff fe83 ffff 23f0 03e8 f10c 0002 0000
0000760 ffc1 fe05 ffff 14fc 03eb cfc5 0565 aa55
0001000
arun@indiangnu:~$
** you can also use following command
arun@indiangnu:~$ od -ax /home/arun/MBR.details
Thank you,
Arun Bagul