Hard drive Main Boot partition)

Source: Internet
Author: User

The primary boot sector of a hard disk is a sensitive area. Its security directly determines whether the hard disk can be used normally. In-depth understanding and flexible use of the primary Boot Sector of the hard disk will help you maintain your system and complete a lot of special work.

I. Differences from Dos boot sectors

For the DOS system, there are two different boot sectors, namely the DOS Boot Sector and the hard drive primary Boot Sector. The dos boot sector exists in the first logical sector of the floppy disk or the first logical sector of the DOS partition of the hard disk. It is generated when the disk is formatted using the format command, it is a necessary condition for guiding the DOS system or correctly using the disk. It can be easily read by debug in DOS:
C>; debug
-L 100 2 0 1
; Read the 0-sector drive C to the 100h of the current memory segment
-D; display dos Boot Sector content
The primary Boot Sector of the hard disk refers to the physical address of the hard disk, which is 0 to 0 sectors and 1 sector. It is generated when fdisk is used for hard disk partitioning, it belongs to the entire hard disk and does not belong to an independent DOS partition. It is a necessary condition for the correct boot and use of the hard disk. Because it is not within the DOS partition range, it cannot be read using the above method. It can only be read using the relevant assembler code:
C>; debug
-
XXXX: 0100 mov ax, 0201 h; number of specified sectors
XXXX: 0103 mov BX, 0800 h; memory address specified
XXXX: 0106 mov CX, 0001 h; specify the track and sector number
XXXX: 0109 mov dx, 0080 h; specifies the head and drive letter
XXXX: 010c INT 13 h; read disk operation
XXXX: 010e int 3-d800; show read content

Ii. Sector structure

The primary Boot Sector of the hard disk occupies one sector, with a total of 512 (200 h) bytes. The specific structure is as follows:
1. The main boot program of the hard disk, located at 0-1bdh of the sector;
2. the hard disk partition table is located at 1beh-1fdh. Each partition table occupies 16 bytes and consists of 4 partition tables. The significance of each of the 16 bytes is as follows:
0: indicates the auto-lift flag. 80 h indicates a boot partition, and 00 indicates a non-boot partition;
1 ~ 3: The starting physical address of the partition on the hard disk;
4: partition type. 1 indicates the basic DOS partition of the 12-bit fat table, 4 indicates the basic DOS partition of the 16-bit fat table, and 5 indicates the extended DOS partition; 6 is a DOS partition larger than 32 m; others are non-dos partitions.
5 ~ 7: end address of the partition;
8 ~ 11: number of sectors before the partition, that is, the absolute sector number of the first sector of the partition;
12 ~ 15: the total number of slice occupied by the partition.
3. Valid indicator of the boot sector, located at 1feh-1ffh, with a fixed value of aa55h.

Iii. Functions of the primary Boot Sector of the hard disk

The content of the primary Boot Sector of the hard disk is basically the same in various dos versions. The main tasks are as follows:
1. Store the hard disk partition table, which is the key data that the hard disk reads and writes correctly.
2. Check the correctness of Hard Disk Partitions. Only one active partition is required.
3. Determine the activity Partition Number and read the boot records of the corresponding operating system.
4. Check the correctness of the Boot Record of the operating system. There is an aa55h mark at the end of the DOS Boot Sector for the boot program to identify.
5. Release the boot permission to the corresponding operating system. For example, when the DOS Operating System Boot Record is confirmed to exist, the DOS boot program is called up and executed.
In addition, some prompts will be provided when it discovers a boot fault, such:
"Invalid Partition Table" indicates that the hard disk partition table is incorrect and there are no or more active partitions;
"Error loading Operating System" indicates an error occurred while reading the DOS Boot Record;
"Missing Operating System" indicates that the DOS boot record does not have a valid aa55h mark.

Iv. Application of the primary Boot Sector of the hard disk

It is precisely the Main Boot Sector of the hard disk that directly determines the security of the hard disk, so it can be used to complete many special functions, a simple list is as follows:
1. Clear the Hard Drive boot function.
Because boot programs must be used to boot the hard disk and check the correctness of the active partition, manual modification or damage to the boot program or removal of the active Partition Boot flag will make the hard disk unable to start.
2. encrypt the entire hard disk.
Aa55h is a prerequisite for the system to acknowledge the hard drive. Therefore, you can clear the ID and modify it to encrypt the hard drive, even if you cannot operate the hard disk from the drive a boot system, you can decrypt the hard disk by restoring it to aa55h.
3. encrypt a single hard disk partition.
To encrypt a single partition of a hard disk, you can modify the partition type. For example, if you change the extended DOS partition type sign 05h to FFH, DOS considers the partition as a non-DOS partition and cannot access it, includes all logical disks in this partition. Of course, modifying or clearing all the data in a partition table can also encrypt a single partition, but the operations are cumbersome and risky.
4. Add the hard disk Startup Password for identification.
Modify the Main Boot Program of the hard disk and add a segment of the password recognition program before guiding the DOS operating system. If the password is correct, the system will be guided normally. Otherwise, the system will reject the boot to identify the password.
5. resident memory programs prior to dos.
Install some interrupt service programs in the main boot program, such as clock interruption, and perform real-time Virus Detection by monitoring int 21h or other dos key data, because this method is completed before guiding the DOS system, the monitoring effect is very reliable.
6. enable multiple operating systems on the same hard disk.
The hard disk can be divided into four independent partitions, loaded into four different operating systems, and multiple DoS versions can be shared through special methods, however, switching between operating systems or DoS versions is very troublesome. By modifying the hard drive Main Boot Program and adding the key recognition process, you can freely select and guide the four partitions.
7. implement self-repair of the primary boot sector or DoS Boot Sector of the hard disk.
If you keep the content of the primary Boot Sector intact in other idle sectors of the hard disk, and check the correctness of the primary Boot Sector before each start of the primary boot program, when an exception is found, that is, you can call the original intact content of the primary Boot Sector to detect and clear viruses in a timely manner, which provides good protection for the system.

Source: http://www.shineblog.com/user3/romanticode/archives/2006/596264.shtml

Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

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.