Ten, hard drive driver

Source: Internet
Author: User
Tags relative
hard disk partition table Disk IntroductionFile system is a software module running in the operating system, is a set of operating system to manage disk file read and write methods and data organization, storage form. So the file system is the program. Its management object is the file, the jurisdiction is the partition, so the file system is based on the partition, each partition can have a different file system. Sector: is the basic unit of hard disk read and write, the sector is numbered from 1, the size of bytes =256*n,n is generally 2, so the sector size is 512 bytes. Track: The carrier of a sector, starting from 0, is a concentric circle on the platter. Head: A disk has two heads, starting from 0 cylinders: a cylinder with the same number of different disk faces, starting from 0. is designed to achieve parallel writes, that is, multi-head writing. When reading and writing a file, it is written by multiple heads simultaneously to a track with the same numbered position in the different disk faces. Partitioning: Consists of multiple numbered cylinders, so the physical representation of a partition is a communication loop consisting of all cylinders within a range. A partition cannot span a cylinder, that is, the same cylinder cannot contain two partitions, a cylinder belongs to only one partition, and the start and end of the partition fall on the complete cylinder. In general, the number of sectors per track is 63 and the sector size is 512 bytes. So hard drive capacity = number of sectors per track * Cylinder Number * 512 bytes * Number of heads. So at the time of partitioning, we just set a reasonable number of cylinders and heads. Partitioning is a logical way to partition disk space, in the final analysis, the cylinder sector on the hard disk is divided into different groupings, each grouping is a separate partition. Each partition has descriptors that describe the partition itself, such as the start and end bounds. In the MBR of 512 bytes, the first 446 bytes are the hard disk parameters and boot, then the 64-byte partition table, a 16-byte, so up to 4 partitions, and finally the magic number 55AA. Disk partition table abbreviation DPT, is a table of multiple partition meta information, each table item in the table corresponds to a partition, the main record of each partition starting sector address, size bounds, and so on. The General partition table is created by the partition tool and the operating system is installed on a partition. The original disk partition table is located in the MBR boot sector, and the MBR is in CHS001 or LBA0. On the hard disk, the first sector is the MBR boot sector, followed by a number of idle sectors, followed by specific partitions. Because the partition to occupy the complete cylinder, the cylinder must not cross the track, and the NO. 0 block is also occupied by the MBR boot sector, so the MBR is located in the track can not be zoned, so the partition start address to offset 1 track size, a track 63 sectors, that is, the other 62 sectors of the track can not participate in the partition. MBR, EBR, OBR MBR partition Table 64 bytes, one partition table is 16 bytes, so up to 4 partition tables are supported. So with the extended partition, the extended partition has no line, if the hard disk has an extended partition, then the other three partitions are the primary partition. Sub-partitions with extended partitions are called logical partitions. This extended partition is the total extended partition, dividing it into multiple sub-extended partitions, each of which is logically equivalent to a hard disk, so each sub-extension partition has an "MBR", which can have a partitioned table, and a partitioned table can have only 4 table entries. Each partition table in the first sector of each sub-extended partition, the sector is the same as the MBR boot sector structure, because it is the total expansion of the zoning out, so they are called ebr--extension boot record. (The sector in which the MBR and EBR are located is called the boot sector, the MBR is the same as the EBR structure, and the contents of the MBR are EBR). The structure of the sub-extended partition is the same as the entire hard disk, the boot sector is the first, the middle is a small number of idle sectors, the last large sector space as a partition, a sub-extended partition can only separate a logical partition. It can be understood that the total extended partition is divided directly into sub-extended partitions, which are split into EBR boot sector, idle sector, and logical partition. The partition table in EBR has 4 table entries, the First partition table entry is used to describe the meta-information of the logical partition contained, the second table entry describes the address of the next sub-extended partition, and the third Fourth table entry is not used. Note: The first and second partition table entries both point to the beginning of the first partition, and the start address is a sector address, but the first partition-partition table entry points to the sector at the beginning of the logical partition, which is called the operating system boot sector, the OBR boot sector, and the second partition table entry is the EBR boot sector. Note: EBR is not part of a partition, is not part of the operating system administration, and the OBR boot sector is located at the beginning of the partition, and is part of the operating system administration. The active partition is the partition where the boot program resides, and the active partition tag is for the MBR to determine if there is an executable bootstrapper in the boot sector of the partition, which is typically the kernel loader, called the Obr--os boot Record. If the MBR discovers that the active partition of the partitioned table is marked as 0x80, it indicates that there is a bootstrapper in the boot sector of the partition. Note: The OBR boot sector is not a EBR or MBR boot sector, although both contain the bootstrapper and the 55AA end, but the difference is that the MBR and the EBR have partitioned tables, where the sector is not within the partition range, created by the partitioning tool, there is no first sector in the partition in the OBR, Managed by the operating system's file system. As a result, the operating system typically adds kernel loaders to the OBR boot sector, and partitioning tools typically add code to the MBR and EBR. The location and size of a partition can be separated byThe zone start offset sector number of sectors to determine the volume. is the 8th and 12th bytes of the partition table entry. Partition start offset sector: is a relative amount that indicates the starting sector address of each partition is the number of offset sectors relative to a datum. The absolute sector LBA address of the partition = The absolute sector start LBA address of the Datum + the starting offset sector of each partition. This datum specifies the upper-level object that is dependent, or the parent object that created the partition. For logical partitions: The base is the start sector of the sub-extended partition for the LBA address for the sub-extended partition: The baseline is the starting sector of the total extended partition for the LBA address for the primary partition or the total extended partition: The baseline is 0. My general partition is: The entire hard disk is divided into a primary partition and a total expansion partition, so that the MBR in the partition table entries 2nd, 3 is 0, only the 1th, 4 items have content. Then partition the sub-extended partition from the total extended partition (one of the sub-extended partitions has a logical partition). Hard Drive driver Hard Disk initializationThere are two IDE channels on the hard disk. Each channel can be hung up to two hard drives, a master, a slaver. The interrupt signal for the two hard disks on the first IDE channel hangs on the 8259A from the IRQ14 of the slices, which share an IRQ interface. The interrupt signal for the two hard disks on the second IDE channel hangs from the IRQ15 on the slice. Two hard drives share a signal, how the CPU distinguishes which hard disk is. Because the hard disk can be interrupted because we have previously operated on a certain hard disk, in this operation we have determined which hard disk, so this channel interrupt signal is issued by this drive.





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.