Differences between MBR, DBR, fat, Dir, and data

Source: Internet
Author: User

The data on the disk is divided into five parts according to their different characteristics and functions: MBR, DBR, fat, Dir, and data. Let's introduce them separately:

(1) MBR zone (main guide sector)
MBR (Main Boot Record), literally understood as the primary Boot Record area, located in the entire hard disk's 0 track 0 cylinder 1 sector. However, in a total of 512 bytes of the primary Boot Sector, MBR only occupies 446 of the bytes (offset 0 -- offset 1bdh ), the other 64 bytes (1beh offset -- 1fdh offset) are handed over to the DPT (Disk Partition Table) (see the table below), and the last two bytes "55, AA "(offset 1feh-offset 1ffh) is the end mark of the partition. This constitutes the primary Boot Sector of the hard disk.
The Master Boot Record contains a series of Hard Disk parameters and a boot program. The main function of the hard disk boot program is to check whether the partition table is correct and boot the operating system on the partition with the activation mark after the system hardware completes the self-check, and hand the control to the boot program. MBR is generated by a partition program (such as fdisk.com). It does not depend on any operating system, and the hard disk boot program can also be changed to realize coexistence of multiple systems.
Meaning of the Offset Length
0-byte partition status: for example, 0 --> inactive partition
80 --> active partition
1 byte starting header of the partition (head)
2. Start slice and start cylinder of the partition
4 bytes this partition type: for example, 82 --> Linux native Partition
83 --> Linux swap Partition
5 bytes of the partition termination header (head)
6 words: Terminate the slice and terminate the cylinder of the partition
8 double-click the start absolute partition of the partition
C: The number of slices in the partition.
Next, we will use an example to help you better understand the Master Guide record:
Example: 80 01 01 00 0b Fe bf fc 3f 00 00 00 7E 86 BB 00
Here we can see that the "80" at the top is the activation mark of a partition, indicating that the system is bootable; "01 01 00" indicates that the head number starting with the partition is 01, the START slice number is 01, and the START cylinder number is 00; "0b" indicates that the partition system type is FAT32, and other commonly used slice numbers include 04 (fat16) and 07 (NTFs ); "Fe bf fc" indicates that the head number of the partition end is 254, the end sector number is 63, and the end cylindrical number is 764; "3f 00 00" indicates that the relative sector number of the first sector is 63; "7E 86 BB 00" indicates that the total number of sectors is 12289622.
(2) DBR Zone
DBR (DOS Boot Record) refers to the Operating System Boot Record area. It is usually located in the hard disk's 0 track 1 cylindrical 1 sector, is the first sector that the operating system can directly access, it includes a boot program and a known as BPB (BiOS parameter block) this partition parameter record table. The main task of the boot program is to determine whether the first two files in the partition and directory are operating system boot files when the MBR gives control of the system (DOS is used as an example, that is, Io. sys and msdos. sys ). If it is determined that the file exists, read it into the memory and give control to the file. The BPB parameter block records important parameters such as the starting sector, ending sector, file storage format, hard disk media descriptor, root directory size, fat number, and allocation unit size of the partition.
(3) fat Zone
After DBR, we are familiar with the fat (File Allocation Table) area. Before explaining the concept of a file allocation table, let's talk about the concept of a cluster. When a file occupies disk space, the basic unit is not a byte but a cluster. The cluster size is related to the disk type. Generally, each cluster of a floppy disk is one sector, and the number of sectors of each cluster of the hard disk is related to the total capacity of the hard disk, may be 4, 8, 16, 32, 64 ......
As we know above, the data of the same file is not necessarily stored in a continuous area of the disk, but is often divided into several segments and stored like a chain. This storage method is called the chained storage of files. Files on hard disks are often created, deleted, increased, and shortened. The more you do this, the more fragmented the files on the disk (each segment must be at least 1 Cluster ). However, because the hard disk stores the connection information (FAT) between segments, the operating system can always accurately locate and read each segment when reading files. However, this storage method is also flawed. This is mainly manifested in the use of space. The last cluster of each file may have an incomplete space (called the tail cluster space ). Generally, when the number of files is large, each file will waste half of the cluster space on average.
Now let's get down to the point. To achieve file chain storage, the hard disk must accurately record which clusters have been occupied by files, you must also specify the ID of the next cluster that stores the subsequent content for each occupied cluster. For the last cluster of a file, you must specify that this cluster does not have any successor cluster. These are all stored in the fat table. There are many table items in the table, and each item records the information of a cluster.
Because of the importance of fat for file management, fat has a backup, that is, the same fat is created after the original fat. All items in the initial fat are marked as "not occupied", but if the disk is partially damaged, the formatting program will detect the damaged cluster, when the corresponding item is named "Bad cluster", the cluster will no longer be used when files are stored. The number of fat items is the same as the total number of clusters on the hard disk. The number of bytes occupied by each item must be consistent with the total number of clusters, because the number of clusters must be stored. There are many fat formats, the most common and familiar to readers are fat16 and FAT32. fat16 indicates that the File Allocation Table uses 16 digits, A 16-Bit Allocation Table can manage up to 65536 clusters (that is, the 16 power of 2), that is, a specified hard disk partition.
Because each cluster has a maximum storage space of 32 KB, when using fat16 to manage hard disks, the maximum storage capacity of each partition is only (65536 × 32 KB), that is, 2048 MB, that is what we often call 2G. The current hard disk capacity is getting bigger and bigger. Due to fat16's limitation on hard disk partition capacity, when the hard disk capacity exceeds 2 GB, you can only divide the hard disk into multiple 2 GB partitions before it can be used normally, for this reason, Microsoft started to use the FAT32 standard in Windows 95 osr2, that is, using a 32-bit File Allocation Table to manage hard disk files, so that the system can allocate up to 4294967296 (that is, 2 to the power of 32) to files) so when the cluster is also 32 KB, the maximum capacity of each partition can be more than 65 GB. In addition, when FAT32 is used to manage hard disks, the cluster length in each Logical Disk is much smaller than the same capacity Logical Disk managed using fat16. Because the disk space occupied by files stored on the hard disk is the smallest unit of cluster, a file must occupy the entire cluster even if it contains dozens of bytes, therefore, the smaller the cluster capacity of the Logical Disk, the more reasonable the storage space can be used. Therefore, FAT32 is more suitable for large hard disks.
(4) Dir (root directory)
Dir (directory) is the root directory, followed by the second fat table (that is, the backup fat table), records the starting unit of each file (directory) in the root directory, file attributes. When locating the file location, the operating system can know the specific location and size of the file on the hard disk based on the starting unit in the Dir and the fat table.
(5) Data Area
The data zone is the place where data is stored in the real sense. After the Dir zone, it occupies most of the data space on the hard disk.

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.