Differences between MBR, DBR, Fat, dir, and data regions

Source: Internet
Author: User
Tags terminates

From: Internet

The data on disk can be broadly divided into 5 parts according to its different characteristics and functions: MBR, DBR, fat, dir and data. Let's take a look at each:

(1) MBR area (main boot sector)

The MBR (main boot record), by its literal understanding, is the master boot record area, which is located on the entire hard drive of the 0 track 0 cylinder 1 sector. However, in a total of 512 bytes of the main boot sector, the MBR occupies only 446 bytes (offset 0--offset 1BDH), the other 64 bytes (offset 1beh--offset 1FDH) to the DPT (disk Partition table hard disk partition table) (see table below), The last two bytes "55,aa" (offset 1feh-offset 1FFH) are the end flags of the partition. This whole constitutes the main boot sector of the hard disk.

The Master boot record contains a series of parameters and a boot program for the hard disk. The primary role of the hard disk bootstrapper is to check that the partition table is correct and boot the operating system on the partition that has the activation flag after the system hardware completes the self-test, and give control to the startup program. MBR is produced by a partitioner (such as fdisk.com), which does not depend on any operating system, and the hard drive boot program can also be changed to enable multi-system coexistence.

The meaning expressed by the offset length

0-byte partition state: such as 0--> non-active partition

80--> active partition

1 bytes The partition start header (head)

2 words the partition start sector and start cylinder

4 bytes The partition type: such as 82--> Linux native partition

83--> Linux Swap Partition

5 bytes the partition termination header (head)

6 words the partition terminates the sector and terminates the cylinder

8 double word The partition starts with an absolute partition

C Double word number of this partition sector

Below, let's take a look at the master boot record in an example to make it more intuitive:

Example: 0B FE BF FC 3F xx xx, 7E, BB 00

Here we can see that the front "80" is a partition of the activation flag, indicating that the system is bootable; 01 01 00 "Indicates that the partition starts with a number of 01, the beginning of the sector area code is 01, the beginning of the cylinder number is 00;" 0B "indicates the partition system type is FAT32, other more commonly used are (FAT16), (NTFS);" FE BF FC "indicates that the partition end of the magnetic number is 254, the partition ends with a sector code of 63, the partition ends with a cylinder number of 764;" 3F 00 00 00 "indicates that the relative sector area of the first sector is 63;" 7E 00 "means the total number of sectors is 12289622.

(2) DBR area

DBR (Dos boot record) is the meaning of the operating system boot record area. It is typically located on the hard disk's 0 track 1 cylinder 1 sector, which is the first sector that the operating system can access directly, including a bootstrap and a sub-parameter record table called BPB (Bios Parameter Block). The main task of the bootloader is that when the MBR takes control of the system to it, it is judged that the first two files of this partition and the directory are the boot files of the operating system (DOS, for example, Io.sys and Msdos.sys). If it is determined to exist, read it into memory and give control over to the file. The BPB parameter block records important parameters such as the start sector, end sector, file storage format, hard disk media descriptor, root directory size, fat count, allocation unit size, and so on for the sub-region.

(3) Fat area

Behind the DBR is the area of fat (file Allocation table) that we are more familiar with. Before explaining the concept of a file allocation table, let's talk about the concept of cluster (cluster). When a file occupies disk space, the base unit is not a byte but a cluster.         The size of the cluster is related to the specifications of the disk, in general, the floppy disk per cluster is 1 sectors, the number of disk per cluster sector and the total capacity of the hard disk, may be 4, 8, 16, 32, 64 ... As we have learned above, the data of the same file does not necessarily reside in a contiguous area of the disk, but is often divided into segments that are stored like a chain. This type of storage is called chained storage of files. Files on your hard disk often need to be created, deleted, grown, shortened, and so on. The more you do this, the more fragmented the files on the disk may be (at least 1 clusters per segment). However, because the connection information (that is, fat) between the segment and the segment is kept on the hard disk, the operating system can always accurately find the location of each segment and read it correctly when reading the file. However, this cluster-based approach to storage has its drawbacks. This is mainly manifested in the use of space. The last cluster of each file may have a space that is not fully utilized (called the Wake-up space). In general, when the number of files is relatively long, the average of each file to waste half a cluster of space.

Well, let's get to the point, in order to realize the chained storage of the file, the hard disk must accurately record which clusters have been occupied by the file, and must indicate the cluster number of the next cluster that stores the successor content for each occupied cluster, and indicate that there are no succeeding clusters for the last cluster of a file. These are saved by the Fat table, which has many table entries, each of which records a cluster of information.

Because fat is important for file management, FAT has a backup that builds the same fat after the original fat. All items in the initial fat are marked as "unoccupied", but if the disk is partially damaged, the formatter detects the damaged cluster, and the corresponding entry is "Bad cluster", which is no longer used when the file is saved. Fat has the same number of items as the total number of clusters on the hard disk, and each item occupies a number of bytes to match the total number of clusters, because the cluster number needs to be stored. There are many formats for fat, the most common and familiar to the reader is FAT16 and FAT32, where FAT16 refers to a file allocation table using 16-bit numbers, since the 16-bit allocation table can manage up to 65536 (that is, 2 of the 16-square) clusters, which is defined as a hard disk partition.

Since the maximum storage space for each cluster is only 32KB, when using FAT16 to manage the hard disk, the maximum storage capacity per partition is only (65536x32 KB) 2048MB, which is what we often say 2G. Now the hard disk capacity is growing, due to the capacity of the FAT16 on the hard disk partition, so when the hard disk capacity of more than 2G, users can only divide the hard disk into a number of 2G partitions to normal use, for this Microsoft company from the Windows OSR2 version of the use of FAT32 standard, Even if you use a 32-bit file allocation table to manage hard disk files, the system can allocate up to 4294967296 (that is, 2 of 32) clusters for the file, so each partition can be up to 65G or more when the cluster is also 32KB. Also, when you use FAT32 to manage hard disks, the cluster lengths in each logical disk are much smaller than the equivalent capacity logic disks that are managed with the FAT16 standard. Because a file is stored on a hard disk with a minimum amount of disk space in a cluster, a file must occupy the entire cluster even if it has only dozens of bytes, so the smaller the cluster unit capacity of the logical disk, the more reasonable the storage space can be used. So FAT32 is more suitable for large hard drives.

(4) dir zone (Root area)

DIR (directory) is the root area, followed by the second Fat table (the Fat table that is backed up), records the starting unit of each file (directory) in the root directory, the properties of the file, and so on. When locating the file location, the operating system can know the exact location and size of the file on the hard disk based on the starting unit in Dir, combined with the fat table.

(5) Data area

The data area is where the data is stored in a real sense, after the Dir area, occupying most of the data space on the hard disk.

Differences between MBR, DBR, Fat, dir, and data regions

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.