Principle of FAT file system 1
First, the hard physical structure:
Hard disk to store data is based on electric and magnetic conversion principle be achieved. By one or more hard disk coated with a magnetic head and the associated control circuit on both sides of the material disc disc of magnetic material and a metal or glass is installed (Figure 1), wherein the sealing disc and the head of the metal shell in a clean the.
When the hard work to design high-speed rotation speed of the disk, the magnetic head disposed under the disk surface in the radial movement of the control circuit to a specific location and then the data is stored or read out. When the system is writing data to the hard disk, the head of the "Write Data" current produces a magnetic field so that the disc surface state of matter changes and still maintain the write current magnetic field disappears, so that the data is stored down; When the system from the hard disk When reading data, the disk head through the designated area, the disc surface magnetic field induced current or the head coil impedance changes produced, processed by the relevant circuit is reduced to data. So long as the disc surface treatment can be more smooth, more precise and head design to maximize the disc rotation speed, you can create larger, faster hard drives read and write data. This is because the more flat disc surface treatment, the faster the speed the more so that the head can be nearer the surface of the disc, to improve reading, writing, sensitivity and speed; heads smaller and more sophisticated design can make heads occupy less space on the disc , the head build more tracks on a disc to store more data.
Second, the logical structure of a hard disk.
By a number of hard disk (platter), each surface of each disc has a read-write head. If there are N platter. There are 2N faces, corresponding 2N heads (Heads), numbered starting from 0,1,2. Each disk is divided into a plurality of concentric tracks (logical, is not visible.) Into each disc is generally the rule is the same. Thus the radius of each disc are fixed values formed a motor spindle axis cylinder (Cylinders) R concentric then logically numbered from the outside to the inside on each disc 0,1,2 ...... Each track is divided into dozens of sectors (Sector), the usual capacity is 512byte, and in accordance with certain rules numbered 1,2,3 ...... form Cylinders × Heads × Sector sectors. These three parameters are physical parameters that drive.
Third, the disk guiding principle.
3.1 MBR (master boot record) Sector:
Computer after pressing the power button to start the implementation of the motherboard bios. After a series of tests conducted and configuration later. Bios set to embark on the system boot sequence to boot the system. It is assumed that the hard drive. Bios After performing its own procedures on how the implementation of the right to drive it. To the hard disk and then execute the program where it is stored. In fact, a piece of code called a mbr plays a pivotal role. MBR (master boot record), the master boot record, sometimes called the master boot sector. Located throughout the hard disk cylinder 0, head 0, sector 1 (can be seen as the first sector of the hard drive), bios inherent in the implementation of their program will jump to the mbr after the first instruction. The control of the system by mbr to execute. In total 512byte master boot record, MBR boot loader which accounted for the first 446 bytes (offset 0H ~ offset 1BDH), followed by a 64-byte (offset 1BEH ~ offset 1FDH) as DPT ( Disk PartitionTable, hard disk partition table), the last two bytes "55 AA" (Offset 1FEH ~ offset 1FFH) is effectively marks the end of the partition.
MBR does not vary with different operating systems and different, which means that different operating systems there may be the same MBR, even if different, MBR is not entrained nature of the operating system. Having the characteristics of the common pilot.
Here is a view with winhex Seagate 120GB HDD's mbr.
Your hard drive's MBR boot code may not be the case. But even if different functions are performed substantially the same. This is wowocock decompile mbr on disk, and has added a detailed notes, interested can look thin.
In order to facilitate user management operating system disk, adding the concept of a disk partition. Coming a disk is logically divided into pieces. How much disk partition number is limited only by the number of C ~ Z of the English alphabet, the figure of 64 bytes DPT how to represent the properties of multiple partitions it? Microsoft solves this problem by linking approach. In a total of 64 bytes of DPT to 16 bytes for the partition table entries unit describes the attributes of a partition. In other words, the first partition table entry describes a partition of property, usually a basic partition. The second partition table entries describe addition to basic partition the remaining space, in general, what we call the extended partition. This part of the general description in Table 1.
Note: The data in the above table have more than one byte to the actual data shows that according to the status of high display. Storage is based on low to high storage. Both the performance of different, please look carefully. After appearing tables, graphs are the same.
These parameters can also be seen in the sense of winhex:
Description: Each partition table entry occupies 16 bytes, assuming the offset from 0. Partition table entries in Figure 3 3. 4 partition table entries with the partition table entries 3.
1,0 H shift to the active partition if signs can only choose 00H and 80H. 80H is active, 00H inactive. The remaining value is illegal in terms of value for microsoft.
2, re-explain (this is important): greater than 1 byte is stored in little endian format format (little endian format) or called anti saved byte order. Endian format is a way to save a few, so that the least significant bit of the first byte in hexadecimal notation. For example, the low byte value 0x3F000000 relative sector figures in the previous section is expressed as 0x0000003F. This little endian decimal number format is 63.
3, the system at the time of partition, each partition is allowed to cross the cylinder, which are cylindrical unit, which is commonly referred to as partitioning granularity. Sometimes we partition the input size of the partition is 7000M, points out it is 6997M, is the reason. Sector and cylinder parameters offset and offset 6H 2H, the sector accounted for 6 (bit), accounting for 10 cylinders (bit), to offset 6H, for example, used its low six sectors binary representation. The two made their high number of cylinders 10 in the high two offset 7H 8 bits can be composed of 10 cylinders in low 8. It can be seen, in fact, in this way, said partition size is limited, cylinders and heads are numbered starting from 0, sector numbered starting from 1, so a maximum of 1024 cylinders, said sectors × 256 × 63 heads × 512byte = 8455716864byte. That is the usual 8.4GB (actually should be about 7.8GB) limit. In fact the number of heads is usually only used 255 (decided by the assembly language of addressable registers), even if these three bytes by linear addressing, is still inadequate. In a later operating system, more than 8.4GB partition is already not through C / H / S addressing the way. CH ~ but by the offset of 4 bytes offset FH 32 linear sector addresses to represent the total number of sectors occupied by the partition. Seen by four bytes can represent 2 ^ 32 sectors, namely 2TB = 2048GB, present, for most computers, this is already the astronomical figures. 8.4GB on the partition does not exceed the size of partition C / H / S is expressed in linear representation of the sector represented by the same. That is, the two representations are coordinated. Even uncoordinated, also linear addressing prevail.(You may be prompted an error on some systems). End more than 8.4GB partition C / H / S is generally filled with FEH FFH FFH. The maximum value that C / H / S can be represented. Sometimes the column 1024 to fill the mold face. But this is what a few bytes are actually irrelevant.
Although the system uses linear addressing ways to deal with the size of the partition. But not the principle of inter-cylinder remains unchanged. The total number of sectors with the number of the partition between the previous partition reserved sector must still be an integer multiple of the capacity of the cylinder. (Reserved sector is the first sector MBR or virtual store MBR partition table sectors, the total number of sectors in a linear representation of the partition is not included in the reserved sectors. If this is the first partition, retains all sectors of the partition sector before.
Attachment: partition table type flag shown in Figure 4
3.2 Extended partition:
Each extended partition logical drive exists a similar expansion of the MBR boot record (Extended Boot Record, EBR), it was termed