Detailed description of Hard Disk Partition in LINUX

Source: Internet
Author: User
Article Title: Detailed description of the hard disk partition table of the LINUX operating system. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Hard drive primary Boot Sector = hard drive primary Boot Record (MBR) + Hard Disk Partition Table (DPT)
--------------------------------------------------------------
Physical location: 0, 0, and 1 sectors (clindyer 0, side 0, sector 1)
Size: 512 bytes
Among them: MBR 446 bytes (BD), DPT 64 bytes (01BE--01FD), ending mark 2 bytes (55 AA)
Function: the MBR directs the system to DBR by checking the DPT partition information;
Read: Use norton diskedit and choose DRIVE --> physical disk--hard disk from the OBJECT menu,
Then, select disk partition table in the OBJECT menu TO read the data, and use the write object to option in the TOOLS menu TO save the data TO the specified file for backup;
Write: Use norton diskedit, select DRIVE --> floopy disk from the OBJECT menu, and select the DPT
File, and then use the write object to --> physical sector option in the TOOLS menu to write to 001
(Clindyer 0, side 0, sector 1 );
  
Details:
000H--08AH MBR Startup Program (search for boot partition)
08BH--0D9H MBR startup string
0DAH--1BCH ("0 ")
1BEH--1FDH Hard Disk Partition Table
1FEH--1FFH end sign (55AA)
  
Active partition primary Boot Sector (DBR)
--------------------------
Physical location: 1 side, 0 channels, 1 sector (clindyer 0, side 1, sector 1)
Size: FAT16 1 slice, 512 bytes
FAT32 3 sector 1536 bytes
Function: includes information such as machine CMOS (ipv--0059), checks the information, and directs the specified system file, such as NTLDR;
Read: Use norton diskedit and choose DRIVE --> logical disk--disk c from the OBJECT menu,
Then, select boot record from the OBJECT menu to read the data and use
The write object to option is saved TO the specified file for backup;
Write: Use norton diskedit, select DRIVE --> floopy disk from the OBJECT menu, and select the backup DBR.
File, and then use the write object to --> physical sector option in the TOOLS menu to write to 011
(Clindyer 0, side 1, sector 1 );
  
Details:
  
000H--002H 3 BYTE jump command (to start the program and jump to 03EH)
003H--03DH BIOS parameter Area
03EH--19DH DOS Startup Program
19EH--1E5H boot string
1E6H--1FDH file name (IO. SYS, MSDOS. SYS)
1FEH--1FFH end mark (55AA)
  
Hard Disk Partition Table (DPT)
---------------------
Meaning analysis of the number of bytes of the Offset address
  
01BE 1 partition type: 00 indicates inactive partition: 80 indicates active partition; others are invalid partitions.
  
01BF ~ The start address of the 01C1 3 * partition (surface/sector/track). Generally, the start address of the first partition starts from one side, 0 channels, and 1 sector. Therefore, the three bytes must be 010100 bytes.
  
01C2 1 # partition operating system type.
  
01C3 ~ 01C5 3 * end address of the partition (surface/Fan/channel)
  
01C6 ~ 01C9 4 start logical sector of the partition
  
01CA ~ 01CD 4 Total number of sectors occupied by the partition
  
Note: * Note the distribution of bytes in the Start address (surface/sector/track) and end address (surface/Fan/track) of the partition:
  
00000000 01000001 00010101
~~~~~~~~ = ^ =
  
~ Face (head) 8 bits
^ 6-digit sector
= 10 bits
  
# Partition operating system type (File Format flag)
  
4---DOS FAT16 <32 M
5--EXTEND
6--DOS FAT16> 32 M
7---NTFS (OS/2)
83---LINUX> 64 M
  
DPT has a total of 64 bytes (01BE--01FD). As shown above, each partition occupies 16 bytes, so it can represent four partitions, this is why the sum of the primary and extended partitions of a disk can only be four.
  
Logical drive
-----------
The extended partition information is located in the hard disk partition table (DPT) shown above, while the logic drive information is located in the Start sector of the extended partition, that is, the slice corresponding to the start address (surface/sector/track) of the partition. The difference between the information in this slice and the primary boot slice of the hard disk does not include MBR, the 16-byte partition information indicates the start and end addresses of the logical drive.
  
Therefore, when the disk contains only one primary partition and one extended partition (including multiple logical drives, even if data in the primary Boot Sector of the hard disk is lost (including DPT) due to viruses or other causes, the entire hard disk can be recovered through the data on the logical drive.
  
For example, the following is a hard disk partition.
  
Total sectors of the Start fan (logical) end fan
MBR 0 0 1 ------
C 0 1 1 276 239 63 4,188,239 4,188,177
Expansion 277 0 1 554 239 63 4,188,240 8,391,599 4,203,360
D 277 1 554 239 63 4,188,303 8,391,599 4,203,297
  
  
If the primary Partition Table is corrupted, You can manually search for the logical drive data contained in the extended partition table. In this example, the data corresponding to the D disk is used, and then the start fan (logical) is used) 63 is the start fan (logical) of the corresponding extended partition. Changing the start address (surface/sector/track) to 0 is the start address of the extended partition. then, you can use the extended partition to obtain the information of primary partition C, and then you can use the FDISK/MBR command and manually enter the partition table to restore the entire hard disk.
  
It is troublesome to use this method. If you know the size of each partition, you can use pq magic 5 to repartition the disk to the original size (Note: never apply it, we only use it to obtain data), view INFO to obtain the above data, record the data, cancel the partition operation, and then use NORTON DISK2000 to manually modify the DPT table to restore the entire hard disk.
  
Partition Table data corresponding to this example:
  
80 01
01 00 06 EF 7F 14 3F 00 00 00 11 E8 3F 00 00 00
41 15 05 ef bf 2A 50 E8 3F 00 60 23 40 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
  
Extended partition table data:
00 01
41 15 07 ef bf 2A 8F E8 3F 00 21 23 40 00
  
Note: The start sector of the logic and the total number of partitions are low on the left. For example, if the start address of the extended partition in this example is 50 E8 3F 00, it must be changed to 00 3F E8 50 before decimal conversion, the total number of partitions occupied 60 23 40 00 must be changed to 00 40 23 60. Similarly, when you manually enter this value, the high/low conversion is required.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.