On the hard disk, the hard disk 0 cylinder 0 Head First 1 sector is called the main boot sector, also known as the master boot Record -mbr (main boot recording), where the MBR is the following three parts of the composition
1,Bootloader, master boot program---446 bytes
2.Dpt (Disk Partition table), hard disk partition table---64 bytes
3, sector end sign (55AA)--2 bytes
A total of 512 bytes, the first 446 bytes is the master boot record, is the BIOS power-on self-test to run after the code, the middle 64 bytes is a partitioned table.
In simple terms MBR=BOOTLOADER+DPT (64) + END sign (55AA). where the DPT disk partition table (64 bytes, each 16 bytes is a group, altogether 4 groups ),
So what if we get the MBR of a disk in a Linux system? It is not difficult, we can get through the DD command, as shown in:
When we get the MBR of the disk in the Linux system, can we go to see it, here I introduce three ways to view the contents of MBR
Method One, use the Hexdump command to view
[[email protected]5201351 ~]# hexdump-c mbr.bin // Total 33 rows, 32 rows *16 bytes, ending at 55AA
-c displays the corresponding ASCII code in bytes per unit
-c per unit in bytes with 16 mechanism and ASCII code displayed
----------------------------------------------------------------------------------------------------
Method Two, in the VIM command mode input :%!xxd is to convert the former text to 16 binary format.
This method 55AA after the end of a row, the content of 0a, for the content of the author is unclear
----------------------------------------------------------------------------------------------------
Method Three, using the OD command to view
[[email protected]5201351 ~]# od-x mbr.bin // Total 33 rows, 32 rows *16 bytes
But this is not the same as the output of the previous 2 methods, because he ends with a aa55, notice that this method to see each group of two byte swap position to see
such as Aa55 on the hard disk storage is actually 55AA, after the Internet query said is the reason for Little-endian, here is not more explored.
An explanation of the MBR records for disks in Linux