What fs fat format is considered. What to do if data is lost. Organization of the fat file system

Introduction

2.1 FAT16 system

2.2 FAT32 system

2.3 Comparison of FAT16 and FAT32

3.1 NTFS system

3.2 Comparison of NTFS and FAT32

Conclusion

Bibliography

Introduction

Currently, on average, several tens of thousands of files are recorded on one disk. How to sort through all this diversity in order to accurately address the file? The purpose of the file system is an effective solution to this problem.

The file system, from the user's point of view, is the "space" in which files are located. And as a scientific term, it is a way of storing and organizing access to data on information medium or its section. The presence of a file system allows you to determine what the file is called and where it is located. Since on IBM PC-compatible computers information is stored mainly on disks, the file systems used on them determine the organization of data on disks (more precisely, on logical disks). We will look at the FAT file system.

fat ntfs file system

1. History of creation and general characteristics FAT file system

The FAT (File Allocation Table) file system was developed by Bill Gates and Mark McDonald in 1977 and was originally used in the 86-DOS operating system. To achieve portability of programs from the CP/M operating system to 86-DOS, the previously accepted restrictions on file names were retained. 86-DOS was subsequently acquired by Microsoft and became the basis for MS-DOS 1.0, released in August 1981. FAT was designed to work with floppy disks smaller than 1 MB, and initially did not provide support hard drives. FAT currently supports files and partitions up to 2 GB in size.

FAT uses the following file naming conventions:

the name must begin with a letter or number and can contain any ASCII character except space and the characters "/\ :; |=,^*?

The name is no more than 8 characters long, followed by a period and an optional extension of up to 3 characters.

The case of characters in file names is not distinguished and is not preserved.

The structure of the FAT partition is shown in Table 1.1 The BIOS parameters block contains the necessary BIOS information about physical characteristics hard drive. The FAT file system cannot control each sector separately, so it groups adjacent sectors into clusters. This reduces the total number of storage units that the file system must keep track of. The cluster size in FAT is a power of two and is determined by the size of the volume when formatting the disk (Table 1.2). A cluster represents the minimum amount of space that a file can occupy. This results in some of the disk space being wasted. The operating system includes various utilities (DoubleSpace, DriveSpace) designed to compact data on the disk.

Table 1.1 - FAT partition structure

Boot sector BIOS parameter block (BPB) FATFAT (copy) Root directory File area

FAT got its name from the file allocation table of the same name. The file allocation table stores information about the clusters of a logical disk. Each cluster in FAT has a separate entry that indicates whether it is free, occupied by file data, or marked as failed (corrupted). If the cluster is occupied by a file, then the address of the cluster containing the next part of the file is indicated in the corresponding entry in the file allocation table. Because of this, FAT is called a linked list file system. The original version of FAT, developed for DOS 1.00, used a 12-bit file allocation table and supported partitions up to 16 MB (DOS allows you to create a maximum of two FAT partitions). To support hard drives larger than 32 MB, the FAT bit width was increased to 16 bits, and the cluster size was increased to 64 sectors (32 KB). Since each cluster can be assigned a unique 16-bit number, FAT supports a maximum of 216, or 65,536, clusters on a single volume.

Table 1.2 - Cluster sizes

Partition sizeCluster sizeFAT type< 16 Мб4 КбFAT1216 Мб - 127 Мб2 КбFAT16128 Мб - 255 Мб4 КбFAT16256 Мб - 511 Мб8 КбFAT16512 Мб - 1023 Мб16 КбFAT161 Гб - 2 Гб32 КбFAT16

Because the boot record is too small to store the system file search algorithm on disk, the system files must be in a specific location for the boot record to find them. The fixed position of system files at the beginning of the data area imposes a strict limit on the size of the root directory and file allocation table. As a result, the total number of files and subdirectories in the root directory on a FAT drive is limited to 512.

Each file and subdirectory in FAT is associated with a 32-byte directory element containing the file name, its attributes (archive, hidden, system and read-only ), date and time of creation (or entry into it latest changes), as well as other information (Table 1.3).

Table 1.3 - Catalog elements

The FAT file system always fills free place on the disk sequentially from beginning to end. When creating a new file or increasing an existing one, it looks for the very first free cluster in the file allocation table. If during operation some files were deleted and others changed in size, then the resulting empty clusters will be scattered across the disk. If the clusters containing the file data are not located in a row, then the file becomes fragmented. Heavily fragmented files significantly reduce efficiency, since the read/write heads will have to move from one area of ​​the disk to another when searching for the next file record. Operating systems that support FAT usually include special utilities Disk defragmentation, designed to improve the performance of file operations.

Another disadvantage of FAT is that its performance is highly dependent on the number of files stored in one directory. If there are a large number of files (about a thousand), the operation of reading the list of files in a directory may take several minutes. This is because in FAT the directory has a linear, unordered structure, and the names of the files in the directories are in the order in which they were created. As a result, the more entries in the directory, the slower the programs work, since when searching for a file it is necessary to look through all the entries in the directory sequentially. Since FAT was originally designed for the single-user DOS operating system, it does not provide for storing information such as owner information or file/directory access permissions. It is the most common file system and is supported to one degree or another by most modern operating systems. Due to its versatility, FAT can be used on volumes that work with different OS.

Although there is no obstacle to using any other file system when formatting floppy disks, most operating systems use FAT for compatibility. This can be partly explained by the fact that the simple FAT structure requires less space for storing overhead data than other systems. The advantages of other file systems become noticeable only when used on media larger than 100 MB.

It should be noted that FAT is a simple file system that does not prevent file corruption due to abnormal computer shutdown. Operating systems that support FAT include special utilities that check the structure and correct inconsistencies in the file system.

2. Characteristics of the FAT16 and FAT32 file systems and their comparison

.1 FAT16 system

The FAT 16 file system is the main one for the operating systems DOS, Windows 95⁄98⁄Me, Windows NT⁄2000⁄XP, and is also supported by most other systems. FAT 16 is a simple file system designed for small drives and simple structures catalogues. The name comes from the name of the file organization method - File Allocation Table. This table is located at the beginning of the disk. The number 16 means that the file system is 16-bit - 16 bits are used to address clusters. The operating system uses the File Allocation Table to locate a file and determine the clusters that file occupies on the hard drive. In addition, the Table records information about free and defective clusters. To make it easier to understand the FAT16 file system, imagine the table of contents of a book and how you work with this table of contents; this is exactly how the operating system works with FAT 16.

To read a file, the operating system must look up the file name for an entry in the folder and read the file's first cluster number. The first cluster represents the beginning of the file. Then you need to read the FAT element corresponding to the first cluster of the file. If the element contains a label - the last one in the chain, then there is no need to look for anything further: the entire file fits in one cluster. If the cluster is not the last, then the table element contains the number of the next cluster. The contents of the next cluster must be read after the first. When the last cluster in the chain is found, then if the file does not occupy the entire cluster, it is necessary to cut off the extra bytes of the cluster. Extra bytes are trimmed according to the file length stored in the folder entry.

To write a file, the operating system must perform the following sequence of actions. A file description is created in a free folder entry, then a free FAT entry is looked for and a link to it is placed in the folder entry. The first cluster described by the found FAT element is occupied. This FAT element contains the number of the next cluster or the sign of the last cluster in the chain.

The operating system acts in such a way as to collect chains from neighboring clusters in increasing numbers. It is clear that accessing sequentially located clusters will be much faster than accessing clusters randomly scattered across the disk. In this case, clusters that are already occupied and marked in FAT as defective are ignored.

In the FAT16 file system, 16 bits are allocated for the cluster number. Therefore, the maximum number of clusters is 65525, and the maximum cluster size is 128 sectors. In this case, the maximum size of partitions or disks in FAT16 is 4.2 gigabytes. When logically formatting a disk or partition, the operating system tries to use the minimum cluster size so that the resulting number of clusters does not exceed 65525. Obviously, the larger the partition size, the larger the cluster size should be. Many operating systems do not work properly with a cluster size of 128 sectors. As a result, the maximum size of a FAT16 partition is reduced to 2 gigabytes. Typically, the larger the cluster size, the greater the disk space wastage. This is due to the fact that the last cluster occupied by the file is only partially filled. For example, if a 17 KB file is written to a partition with a 16 KB cluster size, then this file will occupy two clusters, with the first cluster being completely full, and only 1 KB of data being written in the second cluster, leaving the remaining 15 KB of space in the second cluster empty. full and will not be available for writing to other files. If a large number of small files are written to large disks, then the loss of disk space will be significant. The following table 2.1 provides information about the possible loss of disk space when different sizes section.

Table 2.1.1 - Waste of disk space

Partition sizeCluster sizeLoss of disk space127 MB2 KB2%128-255 MB4 KB4%256-511 MB8 KB10%512-1023 MB16 KB25%1024-2047 MB32 KB40%2048-4096 MB64 KB50%

There are two possible ways to reduce disk space wastage. The first is dividing the disk space into small partitions with a small cluster size. The second is to use the FAT32 file system<#"center">2.2 FAT32 system

The FAT32 file system is a newer file system based on the FAT format and is supported by Windows 95 OSR2, Windows 98 and Windows Millennium Edition. FAT32 uses 32-bit cluster IDs but reserves the most significant 4 bits, so the effective cluster ID size is 28 bits. Since the maximum size of FAT32 clusters is 32 KB, FAT32 can theoretically handle 8 terabyte volumes. Windows 2000 limits the size of new FAT32 volumes to 32 GB, although it supports existing larger FAT32 volumes (created on other operating systems). The larger number of clusters supported by FAT32 allows it to manage disks more efficiently than FAT 16. FAT32 can use 512-byte clusters for volumes up to 128 MB in size.

The FAT 32 file system is used as the default file system in Windows 98. This operating system comes with special program converting a disk from FAT 16 to FAT 32. Windows NT and Windows 2000 can also use the FAT file system, and therefore you can boot your computer from a DOS disk and have full access to all files. However, some of the most advanced features of Windows NT and Windows 2000 are provided by its own NTFS file system (NT File System). NTFS allows you to create disk partitions up to 2 TB (like FAT 32), but in addition, it has built-in file compression, security and auditing functions necessary when working in a network environment. And in Windows 2000, support for the FAT 32 file system is implemented. Installing the operating system Windows systems NT starts on a FAT disk, but if the user wishes, the data on the disk can be converted to NTFS format at the end of installation.

You can do this later by using the Convert utility. exe supplied with the operating system. A disk partition converted to NTFS becomes inaccessible to other operating systems. To return to DOS, Windows 3.1 or Windows 9x, you need to delete the NTFS partition and create a FAT partition instead. Windows 2000 can be installed on a disk with the FAT 32 and NTFS file systems.

The capabilities of FAT32 file systems are much wider than those of FAT16. The most important feature is that it supports disks up to 2047 GB and works with smaller clusters, thereby significantly reducing the amount of unused disk space. For example, HDD 2 GB in FAT16 uses clusters of 32 KB in size, and in FAT32 - clusters of 4 KB in size. To maintain compatibility with existing programs, networks, and device drivers whenever possible, FAT32 is implemented with minimal changes to the architecture, APIs, internal data structures, and disk format. But since FAT32 table elements are now four bytes in size, many internal and on-disk data structures and APIs have had to be revised or extended. Certain APIs on FAT32 drives are blocked to prevent legacy disk utilities from corrupting the contents of FAT32 drives. Most programs will not be affected by these changes. Existing tools and drivers will work on FAT32 drives. However, MS-DOS block device drivers (such as Aspidisk.sys) and disk utilities need to be modified to support FAT32. All disk utilities supplied by Microsoft (Format, Fdisk, Defrag, and ScanDisk for real and protected mode) have been redesigned to fully support FAT32. In addition, Microsoft is assisting leading disk utility and device driver vendors in modifying their products to support FAT32. FAT32 is more efficient than FAT16 when working with larger disks and does not require them to be partitioned into 2 GB partitions. Windows 98 necessarily supports FAT16, since it is this file system that is compatible with other operating systems, including third-party ones. In MS-DOS real mode and in safe mode Windows 98, the FAT32 file system is significantly slower than FAT16. Therefore, when running programs in MS DOS mode, it is advisable to include Autoexec. bat or PIF file command to download Smartdrv. exe, which will speed up disk operations. Some legacy programs designed for the FAT16 specification may report incorrect information about the amount of free or total disk space if it is more than 2 GB. Windows 98 provides new APIs for MS-DOS and Win32 that allow you to correctly determine these metrics.

.3 Comparison of FAT16 and FAT32

Table 2.3.1 - Comparison of FAT16 and FAT32 file systems

FAT16FAT32Implemented and used by most operating systems (MS-DOS, Windows 98, Windows NT, OS/2, UNIX). On this moment Supported only on Windows 95 OSR2 and Windows 98. Very effective for logical drives smaller than 256 MB. Does not work with disks smaller than 512 MB. Supports disk compression, for example using the DriveSpace algorithm. Does not support disk compression. Processes a maximum of 65,525 clusters, the size of which depends on the size of the logical disk. Since the maximum cluster size is 32 KB, FAT16 can work with logical drives no larger than 2 GB. Capable of working with logical disks up to 2,047 GB with a maximum cluster size of 32 KB.

The maximum possible file length in FAT32 is 4 GB minus 2 bytes. Win32 applications can open files of this length without special processing. Other applications should use the Int 21h interrupt, function 716C (FAT32) with the open flag set to EXTEND-SIZE (1000h).

In the FAT32 file system, 4 bytes are allocated for each cluster in the file allocation table, while in FAT16 - 2, and in FAT12 - 1.5.

The most significant 4 bits of a 32-bit FAT32 table element are reserved and do not participate in the formation of the cluster number. Programs that directly read the FAT32 table must mask these bits and protect them from changing when new values ​​are written.

So, FAT32 has the following advantages over previous implementations of the FAT file system:

supports disks up to 2 TB;

organizes disk space more efficiently. FAT32 uses smaller clusters (4 KB for disks up to 8 GB), which saves up to 10-15% of space on large disks compared to FAT;

the FAT 32 root directory, like all other directories, is now unlimited, it consists of a chain of clusters and can be located anywhere on the disk;

has higher reliability: FAT32 is able to move the root directory and work with a FAT backup, in addition, the boot record on FAT32 drives has been expanded to include a backup copy of critical data structures, which means that FAT32 drives are less sensitive to the occurrence of individual bad areas than existing FAT volumes;

programs load 50% faster.

Table 2.3.2 - Comparison of cluster sizes

Disk size Cluster size in FAT16, KB Cluster size in FAT32, KB256 MB-511 MB8 Not supported512 MB - 1023 MB1641024 MB - 2 GB3242 GB - 8 GBNot supported48 GB-16 GBNot supported816 GB-32 GBNot supported1 6More than 32 GBNot supported32

3. Alternative file NTFS system and its comparison with FAT32

3.1 NTFS system

(New Technology File System) is the most preferred file system when working with Windows NT, since it was specifically designed for this system. Windows NT includes a convert utility that converts FAT and HPFS volumes to NTFS volumes. NTFS has significantly expanded the capabilities for controlling access to individual files and directories, introduced a large number of attributes, implemented fault tolerance, dynamic file compression, and support for POSIX standard requirements. NTFS allows file names up to 255 characters long, and it uses the same algorithm to generate a short name as VFAT. NTFS has the ability to self-recover in the event of an OS or hardware failure, so that the disk volume remains available and the directory structure is not disrupted.

Each file on an NTFS volume is represented by an entry in a special file - the MFT (Master File Table). NTFS reserves the first 16 table entries, about 1 MB in size, for special information. The first table entry describes the main file table itself. This is followed by the MFT mirror entry. If the first MFT record is corrupted, NTFS reads the second record to find a mirror MFT file whose first record is identical to the first MFT record. The location of the MFT data segments and the mirror MFT file is stored in the bootstrap sector. A copy of the boot sector is located in the logical center of the disk. The third MFT entry contains a log file used for file recovery. The seventeenth and subsequent entries in the master file table are used by the actual files and directories on the volume.

The transaction log (log file) records all operations that affect the volume structure, including file creation and any commands that change the directory structure. The transaction log is used to recover an NTFS volume after a system failure. The entry for the root directory contains a list of files and directories stored in the root directory.

The volume allocation scheme is stored in a bitmap file. The data attribute of this file contains a bitmap, each bit of which represents one cluster of the volume and indicates whether the cluster is free or occupied by some file. Also supports a bad cluster file for recording bad areas on the volume and a volume file , containing the volume name, NTFS version, and a bit that is set when the volume becomes corrupted. Finally, there is a file containing an attribute definition table, which specifies the types of attributes supported on the volume and whether they can be indexed, restored by a system restore, etc. allocates space in clusters and uses 64-bit numbering for them , which makes it possible to have 264 clusters, each up to 64 KB in size. As with FAT, the cluster size can vary, but does not necessarily increase in proportion to the disk size. The default cluster sizes when formatting a partition are shown in Table 3.1.

Partition sizeCluster size< 512 Мб512 байт513 Мб - 1024 Мб (1 Гб) 1 Кб1 Гб - 2 Гб2 Кб2 Гб - 4 Гб4 Кб4 Гб - 8 Гб8 Кб8 Гб - 16 Гб16 Кб16 Гб - 32 Гб32 Кб>32 GB64 KB allows you to store files up to 16 exabytes (264 bytes) in size and has built-in real-time file compaction. Compression is one of the attributes of a file or directory and, like any attribute, can be removed or installed at any time (compression is possible on partitions with a cluster size of no more than 4 KB). When compressing a file, unlike the compaction schemes used in FAT, file-by-file compaction is used, thus, damage to a small section of the disk does not lead to the loss of information in other files.

To reduce fragmentation, NTFS always tries to store files in contiguous blocks. This system uses a B-tree directory structure similar to the high-performance HPFS file system, rather than the linked list used in FAT. This makes searching for files in a directory faster because file names are stored sorted in lexicographical order. was designed as a recoverable file system using a transaction processing model. Each I/O operation that modifies a file on an NTFS volume is considered a transaction by the system and can be executed as an indivisible block. When a file is modified by a user, the log file service records all the information necessary to repeat or roll back the transaction. If the transaction is completed successfully, the file is modified. If not, NTFS rolls back the transaction.

Despite the presence of protection against unauthorized access to data, NTFS does not provide the necessary confidentiality of stored information. To gain access to files, just boot the computer into DOS from a floppy disk and use some third-party NTFS driver for this system.

Beginning with Windows versions NT 5.0 (new name for Windows 2000) Microsoft supports the new NTFS 5.0 file system. The new version of NTFS introduced additional file attributes; Along with the access right, the concept of access denial has been introduced, which allows, for example, when a user inherits group rights to a file, to prohibit him from changing its contents. New system also allows:

introduce restrictions (quotas) on the amount of disk space provided to users;

map any directory (both on the local and remote computer) to a subdirectory on the local disk.

An interesting feature of the new version of Windows NT is dynamic encryption of files and directories, which increases the reliability of information storage. Windows NT 5.0 includes an Encrypting File System (EFS), which uses shared key encryption algorithms. If the encryption attribute is set for a file, then when a user program accesses the file for writing or reading, the file is encoded and decoded transparently to the program.

.2 Comparison of NTFS and FAT32

Advantages:

Fast access speed to small files;

The size of disk space today is practically unlimited;

File fragmentation does not affect the file system itself;

High reliability of data storage and the file structure;

High performance when working with large files;

Flaws:

Higher volume requirements random access memory compared to FAT 32;

Working with medium-sized directories is difficult due to their fragmentation;

More low speed work compared to FAT 3232

Advantages:

High speed;

Low RAM requirement;

Efficient work with medium and small files;

Lower disk wear due to fewer read/write head movements.

Flaws:

Low protection against system failures;

Not effective work with large files;

Limitation on the maximum volume of a partition and file;

Reduced performance due to fragmentation;

Reduced performance when working with directories containing a large number of files;

So, both file systems store data in clusters whose minimum size is 512 b. As a rule, the usual cluster size is 4 Kb. This is where the similarities probably end. Something About Fragmentation: Speed NTFS work decreases sharply when the disk is filled to 80 - 90%. This is due to the fragmentation of service and work files. The more you work with such a busy disk, the stronger the fragmentation and the lower the performance. In FAT 32, fragmentation of the working area of ​​the disk occurs at earlier stages. The point here depends on how often you write/erase data. As with NTFS, fragmentation greatly reduces performance. Now about RAM. The volume of the FAT 32 spreadsheet itself can occupy about several megabytes in RAM. But caching comes to the rescue. What is written to the cache:

Most used directories;

Data about all files currently in use;

Data about free disk space;

What about NTFS? Large directories are difficult to cache, and they can reach several tens of megabytes in size. Plus MFT, plus information about free disk space. Although it should be noted that NTFS still uses RAM resources quite economically. We have a successful data storage system; in MFT, each record is approximately 1 Kb. But still, the requirements for the amount of RAM are higher than for FAT 32. In short, if your memory is less than or equal to 64 Mb, then FAT 32 will be more effective in terms of speed. If it is more, the difference in speed will be small, and often none at all. Now about the hard drive itself. To use NTFS, Bus Mastering is required. What is this? This is a special mode of operation of the driver and controller. When using BM, the exchange occurs without the participation of the processor. The absence of a VM will affect system performance. In addition, due to the use of a more complex file system, the number of movements of the read/write heads increases, which also affects the speed. The presence of a disk cache has an equally positive effect on both NTFS and FAT 32.

Conclusion

The advantages of FAT are low data storage overhead and total compatibility with a huge number of operating systems and hardware platforms. This file system is still used for formatting floppy disks, where the large volume of the partition supported by other file systems does not play a role, and low overhead allows economical use of a small diskette volume (NTFS requires more space for storing data, which is completely unacceptable for floppy disks ).

The scope of FAT32 is actually much narrower - this file system should be used if you are going to access partitions with using Windows 9x and using Windows 2000/XP. But since the relevance of Windows 9x today has practically disappeared, the use of this file system is not of particular interest.

Bibliography

1. http://yura. Puslapiai. lt/archiv/per/fat.html

FAT file systems

FAT16

The FAT16 file system dates back to pre-MS-DOS times and is supported by all operating systems. Microsoft systems to ensure compatibility. Its name File Allocation Table perfectly reflects the physical organization of the file system, the main characteristics of which include the fact that the maximum size of a supported volume (hard drive or partition on a hard drive) does not exceed 4095 MB. In the days of MS-DOS 4 GB hard disks seemed like a pipe dream (20-40 MB disks were a luxury), so such a reserve was quite justified.

A volume formatted to use FAT16 is divided into clusters. The default cluster size depends on the volume size and can range from 512 bytes to 64 KB. In table Figure 2 shows how cluster size varies with volume size. Note that the cluster size may differ from the default value, but must have one of the values ​​​​specified in the table. 2.

It is not recommended to use the FAT16 file system on volumes larger than 511 MB, since for relatively small files, disk space will be used extremely inefficiently (a 1-byte file will occupy 64 KB). Regardless of cluster size, the FAT16 file system is not supported for volumes larger than 4 GB.

FAT32

Beginning with Microsoft Windows 95 OEM Service Release 2 (OSR2) introduced support for 32-bit FAT in Windows. For Windows NT-based systems, this file system was first supported in Microsoft Windows 2000. While FAT16 can support volumes up to 4 GB, FAT32 can support volumes up to 2 TB. The cluster size in FAT32 can vary from 1 (512 bytes) to 64 sectors (32 KB). FAT32 cluster values ​​require 4 bytes (32 bits, not 16 bits as in FAT16) to store cluster values. This means, in particular, that some file utilities designed for FAT16 cannot work with FAT32.

The main difference between FAT32 and FAT16 is that the size of the logical partition of the disk has changed. FAT32 supports volumes up to 127 GB. Moreover, if when using FAT16 with 2 GB disks a cluster of 32 KB in size was required, then in FAT32 a cluster of 4 KB in size is suitable for disks with capacities from 512 MB to 8 GB (Table 4).

This, accordingly, means more efficient use of disk space - the smaller the cluster, the less space is required to store the file and, as a result, the disk is less likely to become fragmented.

When using FAT32, the maximum file size can reach 4 GB minus 2 bytes. If using FAT16 the maximum number of entries in the root directory was limited to 512, then FAT32 allows you to increase this number to 65,535.

FAT32 imposes restrictions on the minimum volume size - it must be at least 65,527 clusters. In this case, the cluster size cannot be such that FAT occupies more than 16 MB–64 KB / 4 or 4 million clusters.

By using long file names, the data required to be accessed from FAT16 and FAT32 does not overlap. When you create a file with a long name, Windows creates a corresponding name in 8.3 format and one or more entries in the directory to store the long name (13 characters of the long file name per entry). Each subsequent occurrence stores the corresponding part of the file name in Unicode format. Such occurrences have the attributes "volume identifier", "read-only", "system" and "hidden" - a set that is ignored by MS-DOS; in this operating system, a file is accessed by its "alias" in 8.3 format.

File system NTFS

IN Microsoft composition Windows 2000 includes support for a new version of the NTFS file system, which, in particular, provides work with directory services Active Directory, reparse points, information security tools, access control and a number of other features.

As with FAT, the main information unit in NTFS it is a cluster. In table Figure 5 shows the default cluster sizes for volumes of various capacities.

When you create an NTFS file system, the formatter creates a Master File Table (MTF) file and other areas to store metadata. Metadata is used by NTFS to implement the file structure. The first 16 entries in MFT are reserved by NTFS itself. The location of the metadata files $Mft and $MftMirr is recorded in the boot sector of the disk. If the first entry in the MFT is corrupted, NTFS reads the second entry to find a copy of the first. A complete copy of the boot sector is located at the end of the volume. In table Figure 6 lists the main metadata stored in MFT.

The remaining MFT entries contain entries for each file and directory located on the volume.

Typically one file uses one MFT entry, but if a file has a large set of attributes or becomes too fragmented, additional entries may be required to store information about it. In this case, the first record of a file, called the base record, stores the location of the other records. Data about small files and directories (up to 1500 bytes) is completely contained in the first record.

File attributes in NTFS

Each occupied sector on an NTFS volume belongs to one or another file. Even file system metadata is part of the file. NTFS treats each file (or directory) as a set of file attributes. Elements such as the file name, its security information, and even the data within it are file attributes. Each attribute is identified by a specific type code and, optionally, an attribute name.

If file attributes fit within a file record, they are called resident attributes. These attributes are always the file name and the date it was created. In cases where the file information is too large to fit into a single MFT record, some file attributes become non-resident. Resident attributes are stored in one or more clusters and represent a stream of alternative data for the current volume (more on this below). NTFS creates an Attribute List attribute to describe the location of resident and non-resident attributes.

In table Figure 7 shows the main file attributes defined in NTFS. This list may be expanded in the future.

CDFS file system

Windows 2000 provides support for the CDFS file system, which conforms to the ISO'9660 standard that describes the layout of information on a CD-ROM. Supported long names files in accordance with ISO’9660 Level 2.

When creating a CD-ROM for use with Windows control 2000 the following should be kept in mind:

  • all directory and file names must contain less than 32 characters;
  • all directory and file names must consist of uppercase characters only;
  • directory depth should not exceed 8 levels from the root;
  • The use of file name extensions is optional.

Comparison of file systems

Under Microsoft Windows 2000, it is possible to use the file systems FAT16, FAT32, NTFS, or combinations thereof. The choice of operating system depends on the following criteria:

  • how the computer is used;
  • hardware platform;
  • size and number of hard drives;
  • information security

FAT file systems

As you may have already noticed, the numbers in the names of the file systems - FAT16 and FAT32 - indicate the number of bits required to store information about the cluster numbers used by the file. Thus, FAT16 uses 16-bit addressing and, accordingly, it is possible to use up to 2 16 addresses. In Windows 2000, the first four bits of the FAT32 file location table are used for its own purposes, so in FAT32 the number of addresses reaches 2 28 .

In table Figure 8 shows the cluster sizes for the FAT16 and FAT32 file systems.

In addition to significant differences in cluster size, FAT32 also allows the root directory to expand (in FAT16, the number of entries is limited to 512 and can be even lower if long file names are used).

Advantages of FAT16

Among the advantages of FAT16 are the following:

  • file system supported by operating systems MS-DOS systems, Windows 95, Windows 98, Windows NT, Windows 2000, as well as some UNIX operating systems;
  • there are a large number of programs that allow you to correct errors in this file system and restore data;
  • if problems arise with booting from the hard drive, the system can be booted from a floppy disk;
  • This file system is quite efficient for volumes smaller than 256 MB.
Disadvantages of FAT16

The main disadvantages of FAT16 include:

  • the root directory cannot contain more than 512 elements. Using long file names significantly reduces the number of these elements;
  • FAT16 supports a maximum of 65,536 clusters, and since some clusters are reserved by the operating system, the number of available clusters is 65,524. Each cluster has a fixed size for a given logical device. When the maximum number of clusters is reached at the maximum cluster size (32 KB), the maximum supported volume size is limited to 4 GB (under Windows 2000). To maintain compatibility with MS-DOS, Windows 95 and Windows 98, the volume size under FAT16 should not exceed 2 GB;
  • FAT16 does not support built-in file protection and compression;
  • On large disks, a lot of space is lost due to the fact that the maximum cluster size is used. Space for a file is allocated based not on the size of the file, but on the size of the cluster.
Advantages of FAT32

Among the advantages of FAT32 are the following:

  • disk space allocation is more efficient, especially for large disks;
  • The root directory in FAT32 is a regular chain of clusters and can be located anywhere on the disk. Thanks to this, FAT32 does not impose any restrictions on the number of elements in the root directory;
  • due to the use of smaller clusters (4 KB on disks up to 8 GB), the occupied disk space is usually 10-15% less than under FAT16;
  • FAT32 is a more reliable file system. In particular, it supports the ability to move the root directory and use backup copy FAT. In addition, the boot record contains a number of data critical for the file system.
Disadvantages of FAT32

The main disadvantages of FAT32:

  • Volume size when using FAT32 under Windows 2000 is limited to 32 GB;
  • FAT32 volumes are not available from other operating systems - only from Windows 95 OSR2 and Windows 98;
  • Boot sector backup is not supported;
  • FAT32 does not support built-in file protection and compression.

File system NTFS

When running Windows 2000, Microsoft recommends formatting all hard drive partitions to NTFS, except for those configurations where multiple operating systems are used (except Windows 2000 and Windows NT). Using NTFS instead of FAT allows you to use the features available in NTFS. These include, in particular:

  • possibility of recovery. This capability is built into the file system. NTFS guarantees data safety due to the fact that it uses a protocol and some information recovery algorithms. In the event of a system failure, NTFS uses the protocol and Additional information For automatic recovery file system integrity;
  • information compression. For NTFS volumes, Windows 2000 supports individual file compression. Such compressed files can be used by Windows applications without prior decompression, which occurs automatically when reading from the file. When closed and saved, the file is packed again;
  • In addition, the following advantages of NTFS can be highlighted:

Some operating system features require NTFS;

Access speed is much higher - NTFS minimizes the number of disk accesses required to find a file;

Protect files and directories. Only on NTFS volumes it is possible to set access attributes for files and folders;

When using NTFS, Windows 2000 supports volumes up to 2 TB;

The file system maintains a backup copy of the boot sector - it is located at the end of the volume;

NTFS supports the Encrypted File System (EFS), which provides protection against unauthorized access to file contents;

When you use quotas, you can limit the amount of disk space consumed by users.

Disadvantages of NTFS

Speaking about the disadvantages of the NTFS file system, it should be noted that:

  • NTFS volumes are not available in MS-DOS, Windows 95, and Windows 98. In addition, a number of features implemented in NTFS under Windows 2000 are not available in Windows 4.0 and earlier versions;
  • For small volumes containing many small files, performance may be reduced compared to FAT.

File system and speed

As we have already found out, for small volumes FAT16 or FAT32 provides more fast access to files compared to NTFS, because:

  • FAT has a simpler structure;
  • the directory size is smaller;
  • FAT does not support file protection from unauthorized access - the system does not need to check file permissions.

NTFS minimizes the number of disk accesses and the time required to find a file. Additionally, if the directory size is small enough to fit in a single MFT entry, the entire entry is read at once.

One entry in the FAT contains the cluster number for the first cluster in the directory. Viewing a FAT file requires searching the entire file structure.

When comparing the speed of operations performed on directories containing short and long file names, keep in mind that the speed of operations for FAT depends on the operation itself and the size of the directory. If FAT searches for a non-existent file, it searches the entire directory - an operation that takes longer than searching the B-tree-based structure used by NTFS. The average time required to find a file is expressed as a function of N/2 in FAT, and as log N in NTFS, where N is the number of files.

The following factors affect the speed at which Windows 2000 can read and write files:

  • file fragmentation. If the file is highly fragmented, NTFS typically requires fewer disk accesses than FAT to find all the fragments;
  • cluster size. For both file systems, the default cluster size depends on the volume size and is always expressed as a power of 2. Addresses in FAT16 are 16-bit, in FAT32 - 32-bit, in NTFS - 64-bit;
  • The default cluster size in FAT is based on the fact that the file location table can have a maximum of 65,535 entries - the cluster size is a function of the volume size divided by 65,535. Thus, the default cluster size for a FAT volume is always larger than than the cluster size for an NTFS volume of the same size. Note that the larger cluster size for FAT volumes means that FAT volumes can be less fragmented;
  • location of small files. Using NTFS files small size are contained in the MFT record. The size of the file that fits into a single MFT record depends on the number of attributes in that file.

Maximum size of NTFS volumes

In theory, NTFS supports volumes with up to 2 32 clusters. But nevertheless, in addition to the lack of hard drives of this size, there are other restrictions on the maximum volume size.

One such constraint is the partition table. Industry standards limit the size of a partition table 2 to 32 sectors. Another limitation is the sector size, which is typically 512 bytes. Because the sector size may change in the future, the current size limits the size of a single volume to 2 TB (2 32 x 512 bytes = 2 41). Thus, 2 TB is the practical limit for NTFS physical and logical volumes.

In table Figure 11 shows the main limitations of NTFS.

Controlling access to files and directories

When using NTFS volumes, you can set access rights to files and directories. These permissions indicate which users and groups have access to them and what level of access is allowed. Such access rights apply both to users working on the computer on which the files are located, and to users accessing the files over the network when the file is located in a directory that is open to remote access.

Under NTFS, you can also set remote access permissions, combined with file and directory permissions. In addition, file attributes (read-only, hidden, system) also restrict access to the file.

Under FAT16 and FAT32 it is also possible to set file attributes, but they do not provide file access rights.

The version of NTFS used in Windows 2000 introduced a new type of access permission - inherited permissions. The Security tab contains the option Allow inheritable permissions from parent to propagate to this file object, which is active by default. This option significantly reduces the time required to change access rights to files and subdirectories. For example, to change access rights to a tree containing hundreds of subdirectories and files, just enable this option - in Windows NT 4 you need to change the attributes of each individual file and subdirectory.

In Fig. Figure 5 shows the Properties dialog panel and the Security tab (Advanced section) - extended access rights to the file are listed.

Let us remind you that for FAT volumes you can control access only at the volume level and such control is only possible with remote access.

Compressing files and directories

Windows 2000 supports compression of files and directories located on NTFS volumes. Compressed files available for reading and writing by any Windows application. There is no need to pre-unpack them for this. The compression algorithm used is similar to that used in DoubleSpace (MS-DOS 6.0) and DriveSpace (MS-DOS 6.22), but has one significant difference - under MS-DOS the entire primary partition or logical device is compressed, whereas under NTFS You can package individual files and directories.

The NTFS compression algorithm is designed to support clusters up to 4 KB in size. If the cluster size is larger than 4 KB, NTFS compression features become unavailable.

Self-healing NTFS

The NTFS file system has the ability to self-heal and can maintain its integrity through the use of a log of performed actions and a number of other mechanisms.

NTFS considers each operation that modifies system files on NTFS volumes as a transaction and stores information about such a transaction in a log. A started transaction can either be completely completed (commit) or rolled back (rollback). In the latter case, the NTFS volume returns to the state before the start of the transaction. To manage transactions, NTFS writes all operations included in a transaction to a log file before writing to disk. Once the transaction is completed, all operations are completed. Thus, there can be no pending operations under NTFS control. In the event of disk failures, pending operations are simply aborted.

NTFS also performs operations that allow it to identify defective clusters on the fly and allocate new clusters for file operations. This mechanism is called cluster remapping.

In this review, we looked at the various file systems supported in Microsoft Windows 2000, discussed the design of each of them, and noted their advantages and disadvantages. The most promising is the NTFS file system, which has large set features not available in other file systems. The new version of NTFS, supported by Microsoft Windows 2000, has even greater functionality and is therefore recommended for use when installing the Win 2000 operating system.

ComputerPress 7"2000

Every time I use FatFs I think it would be nice to understand how everything works inside. I put this question off for a long time, and finally the ice has broken. So, the global goal is to smoke memory cards, if it works out in detail, the current goal is to deal with the file system.

I’ll say right away that I had no goal of writing my own driver or understanding the intricacies in detail, I was just interested. The task is quite simple to understand, so there will be no “codes” here.

So, the first thing we need to understand is that when communicating with a memory card directly, we can either read or write 512 bytes, no other actions are given. Since we constantly copy and delete files, and the file sizes are always different, empty areas will appear on the card mixed with the recorded ones. So that the user does not have to worry about placing data, there is a layer that takes care of these concerns; this is the file system.

As mentioned above, you can only write and read in multiples of 512 bytes, i.e. 1 sector. There is also a concept - a cluster is simply several sectors, for example, if the cluster size is 16 kB, then it means that it has 16000/512 = 31.25, or rather 32 sectors, and the real cluster size is 16384 bytes. All files occupy a size that is a multiple of the cluster size. Even if the file is 1kB in size, and the cluster is 16kB, the file will occupy the entire 16kB.

It would be logical to make small clusters, but then the limitation on the maximum number of files and their size comes into play. FAT16 operates on 16-bit data, so you cannot cram more than 2^16 clusters. Therefore, the smaller their size, the more efficiently the space for small files is used, but the less information can be crammed onto the disk. And vice versa, the larger the size, the more information you can cram in, but the less efficiently the space for small files is used. Maximum size cluster is 64kB, so the maximum for FAT16 is 64kb*2^16 = 4Gb.

Initial data: there is a 1GB micro SD memory card. Labeled MYDISK, fully formatted, cluster size 16kB.

You will need a Hex editor, but any editor will not work; you need one that can view the entire disk, and not just the files on the disk. From what I was able to find: WinHex is the most suitable, but paid; HxD is simple, free, but I couldn't get it to save changes to disk; DMDE is a bit non-user friendly, free and allows you to save changes. In general, I settled on HxD.

First, it’s worth considering the structure of FAT16, the picture shows in what order the various parts of the file system are located.

All service information is stored in the boot sector. The FAT area stores information about how file data is located on the disk. The root directory contains information about what files are in the root of the disk. The data area contains the information contained within the files. All areas strictly follow each other in a row, i.e. After the boot sector, the FAT area immediately begins. Let's look at the details below.

Task: to understand the principle by which file names and their contents are arranged. So let's start by searching the root directory to understand what files we have available. Data from the boot area will help us with this.

The most interesting data is shown in the table

The first thing we need is to know the size of the boot area. We look at address 0x0E and see that 4 sectors are allocated for the boot area, i.e. The FAT area begins at address 4*512 = 0x800.

The number of FAT tables can be determined by address 0x10 of the boot area. In our example, there are two of them, why two, because each table is duplicated as a backup table, so that in case of a failure the data can be restored. The table size is specified at address 0x16. Thus, the size of the file is 512*2*0xEE = 0x3B800, and the root directory starts at the address: 0x800 + 0x3B800 = 0x3C000

Inside the root directory, all elements are divided into 32 bytes. The first element is the volume label, but the subsequent elements are files and folders. If the file name starts with 0xE5, this means that the file has been deleted. If the name starts with 0x00, it means that the previous file was the last one.

I came up with a rather interesting root directory structure. The card was completely formatted, then 2 text files were created, which were renamed MyFile.txt and BigFile.txt.

As you can see, in addition to my two files, a bunch of left-wing ones have been created, the origin of which can only be guessed at.

The most important thing that can be emphasized here is the address of the first cluster from which the data of our file begins. The address is always located at offset 0x1A. For example, the name of our file MyFile.txt is located at address 0x3C100, we add 0x1A to it, there we see the number of the first cluster. = 0x0002 i.e. second cluster. For the BigFile.txt file, the data starts from the third cluster.

Also in the root directory you can also find out the date and time of the last edit of the file; this question was not very interesting to me, so I will bypass it. The last useful thing the root directory can tell you is its size so that we can find where the data starts.

The size is indicated in the boot sector at address 0x11(2bytes) = 0x0200*32 = 0x4000 or 16384 bytes.

Let's add its size to the root address: 3C000 + 4000 = 40000 is the address of the first data cluster, but we need the second one to find MyFile.txt. The number of sectors in the cluster is 32, cluster size = 32*512 = 16384 or 0x4000, so let’s add to the address of the first cluster its size, i.e. In theory, the second cluster should start at 0x44000.

We go to address 0x44000 and see that the data belongs to BigFile.txt (it’s just garbage)

It turns out there is a small subtlety, the numbering of clusters starts from the second, it is not clear why this was done, but it is a fact, i.e. in fact, we have moved to the third cluster. Let's go back one cluster to address 0x40000 and see the expected data.

Now the question arises. Why do we need a FAT table? The point is that the data can be fragmented, i.e. The beginning of the file may be in one cluster, and the end in a completely different one. Moreover, these can be completely different clusters. There may be several of them, scattered in different data areas. The FAT table is a kind of map that tells us how to move between clusters.

Let's give an example: a bunch of random garbage is stuffed into the BigFile.txt file so that it occupies not one cluster, but several. We go to where the FAT table begins and look at its contents.

The first eight bytes 0xF8FFFFFF are the identifier for the beginning of the fat table. Next are 2 bytes that refer to MyFile.txt; the fact that 0xFFFF is written in them means that the file occupies only one cluster. But the next file BigFile.txt starts in the third cluster, we remember this from the root directory, continues in the fourth, then goes to 5,6,7... and ends at 12, i.e. occupies 10 clusters.

Let's check if this is really the case. The file weighs 163kB, i.e. occupies 163000/(32*512) = 9.9 clusters, which is quite similar to what is expected. Let us repeat once again that one element in the FAT table takes 2 bytes, i.e. 16 bits, hence the name FAT16. Accordingly, the maximum address is 0xFFFF, i.e. maximum volume for FAT16 0xFFFF*cluster size.

Let's move on to FAT32. The loading part has been slightly changed.

There are some fundamental changes. The file system name has moved to address 0x52, the root size is now ignored. The data area is just behind the FAT tables, the root directory is inside the data area. Additionally, the root directory does not have a fixed size.

The data area address is calculated:
boot sector size + FAT table, in my case it turned out:
746496 + (3821056 * 2) = 0x800000

The root directory address is calculated:
(number of the first cluster of the root directory - 2) * cluster size + address of the beginning of the data area,
those. in this example it will coincide with the beginning of the data area.

As before, the data in the root takes up 32 bytes, as before, the “deleted” magic files, I assume these are temporary notepad files.

But the beginning of the first cluster in MYFILE.txt is now determined by two bytes, the highest one at offset 0x14, the lowest one as before 1A. Therefore, the number of the first data cluster for the file will be:
8000A0 + 0x14 = 0x8000B4 - high byte
8000A0 + 0x1A = 0x8000BA - low byte
In my case, the card had only one file, so this is the third cluster.

The FAT table is searched as in the previous case, only now the elements occupy 4 bytes, hence the name FAT32. The ideology of the arrangement of elements is exactly the same as in the previous case.

Useful things for the table
F8 FF FF F0 - first cluster
FF FF FF 0F - last cluster
FF FF FF F7 - damaged cluster

Where is the data?
beginning of the data area + cluster size * (root cluster number - 1)
= 0x800000 + (2*4096) = 0x801000

I hope in general terms it became clear, it seems like there is nothing supernatural. Those who read and repeat can eat a cookie :)

FAT(English) File Allocation Table- “file allocation table”) is a classic file system architecture that, due to its simplicity, is still widely used for flash drives. Used in floppy disks and some other storage media. Previously used on hard drives.

The file system was developed by Bill Gates and Mark MacDonald in 1977 and was originally used in the 86-DOS operating system. 86-DOS was subsequently acquired by Microsoft and became the basis for MS-DOS 1.0, released in August 1981. FAT was designed to work with floppy disks smaller than 1 MB, and did not initially provide support for hard disks.

There are currently four versions of FAT - FAT8, FAT12, FAT16 And FAT32. They differ in the bit depth of records in the disk structure, that is the number of bits allocated to store the cluster number. FAT12 is used mainly for floppy disks, FAT16 for small disks, FAT32 for hard disks. A new file system was developed based on FAT exFAT(extended FAT), used primarily for flash drives.

The FAT file system fills free disk space sequentially from beginning to end. When creating a new file or increasing an existing one, it looks for the first free cluster in the file allocation table. If some files have been deleted and others have changed in size, the resulting empty clusters will be scattered across the disk. If the clusters containing the file data are not located in a row, then the file is fragmented. Heavily fragmented files significantly reduce efficiency, since the read/write heads will have to move from one area of ​​the disk to another when searching for the next file record. It is advisable that the clusters allocated for storing the file are located next to each other, as this reduces the time it takes to search for it. However, this can only be done using a special program; this procedure is called defragmentation file.

Another disadvantage of FAT is that its performance depends on the number of files in one directory. If there are a large number of files (about a thousand), the operation of reading the list of files in a directory may take several minutes. FAT does not store information such as file ownership or file permissions.

FAT is a simple file system that does not prevent file corruption due to abnormal computer shutdown, it is one of the most common file systems and is supported by most operating systems.

Organization of the fat file system

All modern disk operating systems provide the creation of a file system designed to store data on disks and provide access to them. In order for data to be written to a disk, its surface must be structured - i.e. divide into sectors And tracks.

A-track

C-cluster

Figure 1 - Disk structure

Paths- these are concentric circles covering the surface of the disk. The track closest to the edge of the disk is assigned the number 0, the next one - 1, etc. If the floppy disk is double-sided, then both sides are numbered. The number of the first side is 0, the number of the second is 1.

Each track is divided into sections called sectors. Sectors are also assigned numbers. The first sector on the track is assigned the number 1, the second - 2, etc.

A hard drive consists of one or more round platters. Both surfaces of the plate are used to store information. Each surface is divided into tracks, tracks, in turn, into sectors. Paths of the same radius are cylinder. Thus, all zero tracks make up cylinder number zero, tracks number 1 make up cylinder number 1, etc.

Therefore, the surface of a hard drive can be considered as a three-dimensional matrix, the dimensions of which are the numbers surface, cylinder And sectors. A cylinder is understood as a set of all tracks belonging to different surfaces and located at an equal distance from the axis of rotation.

In FAT, file names are in 8.3 format and consist only of ASCII characters. VFAT has added support for long (up to 255 characters) file names. Long File Name, LFN) in UTF-16LE encoding, with LFNs stored concurrently with 8.3 names, retrospectively called SFNs. Short File Name). LFNs are case-insensitive when searching, however, unlike SFNs, which are stored in uppercase, LFNs preserve the case specified when the file was created.

FAT system structure

In the FAT file system, contiguous disk sectors are combined into units called clusters. The number of sectors in a cluster is equal to a power of two (see below). An integer number of clusters (at least one) are allocated to store file data, so, for example, if the file size is 40 bytes and the cluster size is 4 KB, only 1% of the space allocated for it will actually be occupied by file information. To avoid such situations, it is advisable to reduce the size of clusters, and to reduce the amount of address information and increase the speed of file operations, vice versa. In practice, some compromise is chosen. Since the disk capacity may not be expressed in an entire number of clusters, usually at the end of the volume there are so-called. surplus sectors - a “remainder” of less than a cluster size that cannot be allocated by the OS for storing information.

The FAT32 volume space is logically divided into three contiguous areas:

  • Reserved area. Contains service structures that belong to the partition boot record (Partition Boot Record - PBR, to distinguish it from the Master Boot Record - the main boot record of the disk; PBR is also often incorrectly called the boot sector) and are used when initializing a volume;
  • An area of ​​a FAT table containing an array of index pointers ("cells") corresponding to the clusters of the data area. Typically there are two copies of the FAT table on the disk for reliability purposes;
  • The data area where the actual contents of the files are recorded - that is, text text files, encoded image for picture files, digitized sound for audio files, etc. - as well as the so-called. metadata - information regarding the names of files and folders, their attributes, creation and modification times, sizes and placement on disk.

FAT12 and FAT16 also specifically allocate the root directory area. It has a fixed position (immediately after the last element of the FAT table) and a fixed size in sectors.

If a cluster belongs to a file, then the corresponding cell contains the number of the next cluster of the same file. If the cell corresponds to the last cluster of the file, then it contains a special value (FFFF 16 for FAT16). In this way, a chain of file clusters is built. Unused clusters in the table correspond to zeros. “Bad” clusters (which are excluded from processing, for example, due to the unreadability of the corresponding area of ​​the device) also correspond to a special code.

When a file is deleted, the first character of the name is replaced special code E5 16 and the file cluster chain in the allocation table is reset to zero. Since information about the file size (which is located in the directory next to the file name) remains intact, if the file clusters were located sequentially on the disk and they were not overwritten by new information, it is possible to restore the deleted file.

Boot entry

The first FAT volume structure is called BPB. BIOS parameter block ) and is located in a reserved area, in sector zero. This structure contains information identifying the type of file system and the physical characteristics of the storage medium (floppy disk or hard disk partition).

BIOS Parameter Block

BPB was basically absent from the FAT that served MS-DOS 1.x, since at that time there were only two various types volumes - single- and double-sided five-inch floppy disks of 360 kB, and the volume format was determined by the first byte of the FAT area. BPB was introduced in MS-DOS 2.x in early 1983 as a mandatory boot sector structure that would henceforth determine the volume format; The old scheme of determining by the first byte of FAT has lost support. Also in MS-DOS 2.0, a hierarchy of files and folders was introduced (before this, all files were stored in the root directory).

The BPB structure in MS-DOS 2.x contained a 16-bit “total number of sectors” field, which meant that this version of FAT was fundamentally inapplicable for volumes larger than 2 16 = 65,536 sectors, that is, more than 32 MB with a standard sector size of 512 bytes. In MS-DOS 4.0 (1988), the above BPB field was expanded to 32 bits, which meant the theoretical volume size increased to 232 = 4,294,967,296 sectors, or 2 TB with a 512-byte sector.

The next modification of BPB appeared with Windows 95 OSR2, which introduced FAT32 (in August 1996). The two-gigabyte limit on volume size has been removed; a FAT32 volume can theoretically be up to 8 TB in size. However, the size of each individual file cannot exceed 4 GB. BIOS Parameter Block FAT32, for compatibility with earlier versions of FAT, repeats the BPB FAT16 up to and including the BPB_TotSec32 field, followed by differences.

The FAT32 "boot sector" is actually three 512-byte sectors - sectors 0, 1 and 2. Each of them contains the 0xAA55 signature at address 0x1FE, that is, in the last two bytes if the sector size is 512 bytes. If the sector size is more than 512 bytes, then the signature is contained both at address 0x1FE and in the last two bytes of the zero sector, that is, it is duplicated.

FSInfo

The boot record of a FAT32 partition contains a structure called FSInfo, used to store the number of free clusters on the volume. FSInfo, as a rule, occupies sector 1 (see the BPB_FSInfo field) and has the following structure (addresses relative to the beginning of the sector):

  • FSI_LeadSig. The 4-byte signature 0x41615252 indicates that the sector is used for the FSInfo structure.
  • FSI_Reserved1. The interval from the 4th to the 483rd byte of the sector, inclusive, is reset to zero.
  • FSI_StrucSig. Another signature is located at address 0x1E4 and contains the value 0x61417272.
  • FSI_Free_Count. The four-byte field at address 0x1E8 contains the last value of the number of free clusters on the volume known to the system. A value of 0xFFFFFFFF means that the number of free clusters is unknown and must be calculated.
  • FSI_Nxt_Free. The four-byte field at address 0x1EC contains the cluster number from which the search for free clusters should begin in the table of index pointers. Typically this field contains the number of the last FAT cluster allocated to store the file. The value 0xFFFFFFFF means that the search for a free cluster should be carried out from the very beginning of the FAT table, that is, from the second cluster.
  • FSI_Reserved2. Reserved 12-byte field at address 0x1F0.
  • FSI_TrailSig. Signature 0xAA550000 - last 4 bytes of the FSInfo sector.

The point of introducing FSInfo is to optimize system operation, since in FAT32 the table of index pointers can be significant and scanning it byte-by-byte can take considerable time. However, the values ​​of the FSI_Free_Count and FSI_Nxt_Free fields may not be correct and should be checked for adequacy. In addition, they are not even updated in the FSInfo backup, which is usually located in sector 7.

Determining the FAT volume type

The determination of the FAT type of a volume (that is, the choice between FAT12, FAT16 and FAT32) is made by the OS based on the number of clusters in the volume, which in turn is determined from the BPB fields. First of all, the number of sectors of the root directory is calculated:

RootDirSectors = (BPB_RootEntCnt * 32) / BPB_BytsPerSec

DataSec = TotSec - (BPB_ResvdSecCnt + (BPB_NumFATs * FATSz) + RootDirSectors)

Finally, the number of data area clusters is determined:

CountofClusters = DataSec / BPB_SecPerClus

Based on the number of clusters, there is a clear correspondence with the file system:

  • CountofClusters< 4085 - FAT12
  • CountofClusters = 4085 ÷ 65524 - FAT16
  • CountofClusters > 65524 - FAT32

According to the official specification, this is the only valid way to determine the FAT type. Artificially creating a volume that violates the specified compliance rules will result in Windows processing it incorrectly. However, it is recommended to avoid CountofClusters values ​​close to critical (4085 and 65525) in order to correctly determine the file system type by any, often incorrectly written, drivers.

Over time, FAT began to be widely used in various devices for compatibility between DOS, Windows, OS/2, Linux. Microsoft has shown no intention of forcing them to license [ specify] .

In February 2009, Microsoft sued TomTom, a manufacturer of Linux-based car navigation systems, alleging patent infringement.

Notes

  1. http://cd.textfiles.com/megademo2/INFO/OS2_HPFS.TXT
  2. www.microsoft.com/mscorp/ip/tech/fathist.asp at archive.org
  3. Microsoft Extensible Firmware Initiative FAT32 File System Specification 1.03. Microsoft (December 6, 2000). - Document format Microsoft Word, 268 KB. Archived
  4. What About VFAT? . TechNet Archive. Microsoft (October 15, 1999). Archived from the original on August 22, 2011. Retrieved April 5, 2010.
  5. The VFAT file system extension should not be confused with the file system driver of the same name, which appeared in Windows for Workgroups 3.11 and is designed to process calls to MS-DOS functions (INT 21h) in protected mode (see: KB126746: Windows for Workgroups Version History. VERSION 3.11 → Non-Network Features. Microsoft (November 14, 2003). Archived from the original on August 22, 2011. Retrieved April 5, 2010.)
  6. Federal Patent Court declares FAT patent of Microsoft null and void (English). heise online. Heise Zeitschriften Verlag (2 March 2007). Archived
  7. Brian Kahin. Microsoft Roils the World with FAT Patents. The Huffington Post (March 10, 2009). Archived from the original on August 22, 2011. Retrieved March 10, 2009.
  8. Ryan Paul. Microsoft suit over FAT patents could open OSS Pandora's Box (English). Ars Technica. Condé Nast Publications (February 25, 2009). Archived
  9. Glyn Moody.(English) . ComputerworldUK. IDG (5 March 2009). Archived from the original on August 22, 2011. Retrieved March 9, 2009.
  10. Steven J. Vaughan-Nichols. Linux companies sign Microsoft patent protection pacts (English). Computerworld Blogs. IDG (5 March 2009). Archived from the original on August 22, 2011. Retrieved March 9, 2009.
  11. Erica Ogg. TomTom countersues Microsoft in patent dispute. CNet (March 19, 2009). Archived from the original on August 22, 2011. Retrieved March 20, 2009.

Links

  • ECMA-107 (English) FAT standard



Top