Fat ntfs file system. See what "FAT" is in other dictionaries. Different versions of FAT

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

I must say right away that I had no goal to write my own driver or to understand in detail the intricacies, I was just interested. The task is quite simple to understand, so there will be no "codes" here.

So, the first thing we must understand, when communicating with the memory card directly, we can either read or write 512 bytes, no other action is given. Since we constantly copy and delete files, and the file sizes are always different, empty areas will be formed on the map mixed with the recorded ones. In order for the user not to worry about data placement, there is a layer that takes care of these concerns, this is the file system.

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

It would be logical to make clusters of small size, then the limitation on the maximum number of files and their size comes into play. FAT16 operates on 16-bit data, so you can't fit more than 2 ^ 16 clusters. Therefore, the smaller their size, the more efficiently the space is used for small files, but the less information can be crammed onto the disk. Conversely, the larger the size, the more information can be crammed, but the less efficiently space is used for small files. The maximum cluster size is 64kB, so the maximum for FAT16 is 64kb * 2 ^ 16 \u003d 4GB.

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

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

To begin with, consider 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. Inside the FAT area is information about how the file data is located on the disk. In the root directory, 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 begins immediately. The details will be discussed below.

Task: to understand by what principle the file names and their contents are located. So let's start by looking for the root directory to see what files we have available. The data from the boot area will help us with this.

The most interesting data are shown in the table

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

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

Within the root directory, all items are split into 32 bytes. The first item is the volume label, while the subsequent items are files and folders. If the file name starts with 0xE5, it means that the file has been deleted. If the name starts with 0x00, it means that the previous file was the last one.

I've got a pretty interesting structure of the root directory. The card was fully formatted, then 2 text fileswhich have been renamed to MyFile.txt and BigFile.txt.

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

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

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

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

Let's add its size to the root address: 3C000 + 4000 \u003d 40000 this 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, the cluster size \u003d 32 * 512 \u003d 16384 or 0x4000, so we add to the address of the first cluster, its size i.e. in theory, the second cluster should start with 0x44000.

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

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

Now the question is. Why do we need a FAT table? The point is that data can be fragmented, i.e. the beginning of the file can 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 areas of the data. The FAT is a kind of map that tells us how to move between clusters.

For example, a bunch of random garbage is crammed 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 phat table. Then there are 2 bytes that refer to MyFile.txt, the fact that 0xFFFF is written in them means that the file occupies only one cluster. And here next file BigFile.txt starts in the third cluster, as we remember 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) \u003d 9.9 clusters, which is quite what we expect. Let's 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 size for FAT16 0xFFFF * cluster size.

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

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

The address of the data area is calculated:
size of boot sector + FAT table, in my case it turned out:
746496 + (3821056 * 2) \u003d 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 match the start of the data area.

As before, the data in the root occupy 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 most significant at offset 0x14, and the least one as before 1A. Therefore, the number of the first data cluster for the file will be:
8000A0 + 0x14 \u003d 0x8000B4 - high byte
8000A0 + 0x1A \u003d 0x8000BA - low byte
In my case, the map was with only one file, so this is the third cluster.

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

Usefuls 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 located?
start of data area + cluster size * (root cluster number - 1)
\u003d 0x800000 + (2 * 4096) \u003d 0x801000

I hope it became clear in general terms, it seems like there is nothing supernatural. Who has read and repeated it can eat a cookie 🙂

Everyone who has ever installed an operating system has come across the fact that at the stage of formatting the installation partition of a hard disk, the program offers to choose the type of file system FAT or NTFS.

And those who happened to format a flash drive or other external storage device needed to decide between three file systems FAT32, NTFS and exFAT. Most often, users choose the default formatting because they don't know what the difference is.

This article is addressed to those who wish to fill this gap in their knowledge.

FAT file structure: principles and purpose

File structure or File system was developed in the 70s of the last century by Microsoft and represented a certain order of organizing space for storing and accessing data on computers and other digital devices.

The purpose of the functionality is to provide the user with convenient management of information stored on a disk or an external gadget. The file system includes files, folders and directories, as well as a set of system tools that interact with them to perform the functions of read-write, create-delete, copy, naming, etc. In addition, this structure organizes sharing to information between users and provides protection against unauthorized actions by encryption, read-only operation, and so on.

Structurally, the entire area of \u200b\u200bdisk space is divided into clusters, like a sheet of paper in a cell. Each cell is a block, the size of which is specified during formatting and must be a multiple of 2. The minimum size can be 512 bytes (for a flash drive), for a hard disk it is 32 KB. One file can occupy several such clusters. Figuratively, you can imagine disk space in the form of a notebook, where the cluster is a letter, a file is a word, and file structure - the table of contents of the notebook.

When accessing a file, the operating system must find it in several clusters located in different places on the disk, thus forming a chain of clusters. Each cluster has its own label, which defines it as one of three types:

  1. Free, ready to write data.
  2. Busy, who stores some of the information and has data in the label about the next cluster in the chain, while the latter is marked with a special label.
  3. BAD-block - a cluster with errors, which becomes unavailable after formatting.

The size of the label is determined by the type of file structure: for FAT32 it is 32 bytes.

The entire file system consists of the following parts:

  • the boot sector, which is located at the beginning of the disk, is activated after the OS boots and stores the partition parameters;
  • a file allocation table ("table of contents") that stores cluster labels;
  • copies of the file allocation table to recover data if the file structure is damaged;
  • root directory;
  • data areas;
  • cylinder to perform read / write operations.

There are three types of FAT file system in total: FAT12, FAT16, and FAT32. FAT was replaced by NTFS, and exFAT is an extended version of FAT32 and is used mainly for flash drives.

Pros and cons of FAT32, NTFS and exFAT file structures

In order to determine the choice of the most optimal file system for formatting, we will consider the descriptions of all three options, focusing on the advantages and disadvantages of each.

FAT32

Of the three file structures under consideration, FAT32 is the oldest. It replaced FAT16 and was the most progressive until recently. The release of FAT32 was timed to coincide with the release of the operating room windows systems 95 OSR2 in 1996. The main distinguishing features are: 32-bit cluster addressing and size restrictions: a file no more than 4 GB and a volume of 128 GB.

Advantages

Despite some moral backwardness, FAT32 has a number of advantages over other file systems. Its main attraction is compatibility and versatility. FAT32 works with all versions of operating systems, including Windows (comparison of all versions), Linux and MacOS, suitable for any game consoles and other gadgets with USB port... Today it is used in all external storage (flash drives, CD-cards) by default, since many old devices: PCs, laptops, set-top boxes with USB-input can only work with FAT32.

Other important advantages of the file system are: high-speed performance, low volume requirements random access memory, productive work with files of medium and small size, and also a small wear of the disc due to less movement of the head. However, it is also prone to fragmentation, and periodic defragmentation will definitely not hurt.

disadvantages

The main disadvantage of this file system is its size limitations. For clusters, it cannot be more than 64 KB, otherwise some applications may incorrectly calculate disk space.

The file size must not exceed 4 GB, so the maximum disk size for a 32 KB file allocation table cluster would be about 8 TB.

When formatting a disk with ScanDisk, which is a 16-bit program, taking into account the FAT tables themselves and with a maximum cluster size of 32 KB, the volume is limited to 128 GB.

Given the fact that not many computer devices are equipped with a hard drive with a capacity of more than 8 TB, this disadvantage will not be noticeable for most users. However, the fact that FAT32 works with files up to 4 GB in size is a significant disadvantage, since most high-quality video files of the modern 4K format today are larger than these 4 GB, which means they are not compatible with this file system.

Besides size limitations, FAT32 has other disadvantages. It does not support long file names, which is inconvenient for users who want to logically identify files based on their contents. There are complaints about the security system (an additional antivirus scanner will not interfere) and the security of files in case of failures (especially hard drives), as well as low speed when working with directories containing many files.

Thus, FAT32 is more suitable for portable, not very capacious devices and old computers. The latest versions of Windows can no longer be installed on a FAT32 formatted drive, you need to reformat to NTFS.

The main use of the FAT32 file system today is portable flash drives and SD cards (features), which contain few files and are compatible with a variety of digital devices.

NTFS

This file system was developed by Microsoft in 1993 and introduced together with Windows NT 3.1. In the name itself new technology file systemwhich means file system new technology , its progressive essence is laid.

After formatting a disk in NTFS, it is divided into three zones:

  • MFT - zone or general file table (Master File Table), where information about files and directories is stored;
  • user data;
  • metafiles containing service information.

Each of the metafiles is responsible for specific area... For example, LogFile is a log file in which all operations are written to the log, Boot is the boot sector, Bitmap monitors the free space in the partition, etc. Such a structure reliably protects files from any failures, be it an OS freeze or a power outage.

Advantages

Unlike FAT32, this file structure has practically no restrictions on the size of files and directories. The cluster size can vary from 512 bytes to 64 KB, the optimal size is considered to be 4 KB.

With many significant improvements to improve security, such as support for file permissions, HPFS quotas, encryption, journaling, access control and auditing, hard links, and more, NTFS is ideal for formatting a disk for the system area. Other partitions of the hard drive can also be formatted in this system, since NTFS allows optimal use of disk space in the presence of many small files.

The advantage of this file organization is the fast access speed to small files, high performance when working with large files, as well as the ability to use long file names.

disadvantages

The main disadvantage of NTFS is incompatibility with all operating systems below Windows NT, as well as limitations in compatibility with other operating systems. So, Mac OS reads files from NTFS disks, but cannot write them, the same situation with compatibility linux files... The most popular Playstation and Xbox 360 game consoles do not work with NTFS, only the Xbox One can communicate with it.

Among the disadvantages of NTFS are the high requirements for the amount of RAM, lower speed compared to FAT32 and the difficulty of managing medium-sized directories.

Thus, it is more advisable to use the NTFS file structure on hard drives, including SSDs running the latest windows versionsstarting with NT.

exFAT

This file system is the last to be considered for release. She appeared in 2008 with next updates to Windows XP and is, in fact, an extended version of FAT32.

The main goal of the developers is to create a productive, convenient and versatile file structure for portable storage devices: flash drives, SD cards and removable hard drives.

Advantages:

  • Simple organization without specialized features and restrictions on file and partition sizes.
  • Excellent compatibility with all Windows OS as well as Mac OS and Linux. The latter option requires the installation of additional software.
  • Support from all modern apple devices, as well as game consoles Xbox One and Playstation 4.

The main disadvantage of the exFAT file organization is Microsoft's licensing policy that prohibits it free use in the public domain.

The most optimal file structure

After reviewing the descriptions of three popular file systems, the following conclusions can be drawn:

  • for computer devices with an operating system higher than Windows NT, it would be more expedient formatting hard disk in NTFS system;
  • for old devices, as well as for compatibility with various modern digital gadgets, the best option would be to choose FAT32;
  • for any removable media, the system will be ideal

And the last thing: information about what file structure is implemented on your disks can be found in the "General" tab (right mouse button "Properties").

In addition to all other tasks, it fulfills its main purpose - it organizes work with data according to a certain structure. The file system is used for these purposes. What is FS and what it can be, as well as other information about it will be presented below.

general description

The file system is a part of the operating system that is responsible for placing, storing, deleting information on media, providing users and applications with this information, and ensuring its safe use. In addition, it is she who helps in data recovery in the event of a hardware or software failure. This is why the file system is so important. What is FS and what can it be? There are several types:

For hard drives, that is, random access devices;

For magnetic tapes, that is, devices with sequential access;

For optical media;

Virtual systems;

Networked systems.5

A file serves as a logical unit of data storage in a file system, that is, an ordered collection of data that has a specific name. All data used by the operating system is presented in the form of files: programs, images, texts, music, video, as well as drivers, libraries, etc. Each such element has a name, type, extension, attributes, and size. So, now you know, the File system is a collection of such elements, as well as ways to work with them. Depending on the form in which it is used and what principles are applicable to it, several main types of FS can be distinguished.

Programmatic approach

So, if the file system is considered (what is it and how to work with it), then it should be noted that this is a multi-level structure, on its upper level there is a filesystem switch that provides an interface between the system and a specific application. It converts requests for files into a format that is understood by the next layer - drivers. They, in turn, refer to the drivers specific devicesthat store the information you need.

For client-server applications, the FS performance requirements are quite high. Modern systems are designed to provide efficient access, support for large storage media, protect data from unauthorized access, and maintain the integrity of information.

FAT file system

This type was developed back in 1977 by Bill Gates and Mark MacDonald. It was originally used in OS 86-DOS. If we talk about what the FAT file system is, then it is worth noting that initially it was not able to support hard drives, but only worked with flexible media up to 1 megabyte. Now this limitation is no longer relevant, and this FS was used by Microsoft for MS-DOS 1.0 and later versions. FAT uses certain conventions for naming files:

The name must have a letter or number at the beginning, and any ASCII character can be present in it, in addition to the space and special elements;

The name must be no more than 8 characters long, followed by a dot, and then the extension is indicated, which consists of three letters;

Any case can be used in file names; it is not distinguished or preserved.

Since FAT was originally designed for a single-user DOS operating system, it did not provide for storing information about the owner or access rights. At the moment, this file system is the most widespread, to one degree or another it is supported by the majority. Its versatility makes it possible to use it on volumes with which different operating systems work. This is a simple file system that is not able to prevent the corruption of files due to improper shutdown of the computer. Operating systems based on it include special utilitiesthat check the structure and correct file inconsistencies.

File system NTFS

This file system is the most preferable for working with Windows NT, as it was developed specifically for it. The operating system includes a convert utility that converts FAT and HPFS volumes to NTFS volumes. If we talk about what a file nTFS system, it is worth noting that it significantly expanded the ability to control access to certain directories and files, introduced many attributes, implemented dynamic file compression, fault tolerance, and supported the POSIX standard requirements. This file system can use names up to 255 characters long, while the short name is generated in it in the same way as in VFAT. Understanding what the NTFS file system is, it is worth noting that in the event of an operating system failure, it is able to recover itself, so the disk volume will remain accessible, and the directory structure will not suffer.

Features of NTFS

On an NTFS volume, each file is represented by an entry in the MFT. The first 16 records of the table are reserved by the file system itself for storing special information. The very first entry describes the file table itself. When the first record is destroyed, the second is read to find a mirrored MFT file, where the first record is identical to the main table. A copy of the boot file is located at the logical center of the disk. The third record of the table contains the log file, which is used for data recovery. The seventeenth and subsequent entries in the file table contain information about the files and directories that are on the hard disk.

The transaction log contains a complete set of operations that change the structure of a volume, including operations to create files, as well as any commands that affect the directory structure. The transaction log is designed to recover NTFS from a system crash. The entry for the root directory contains a list of directories and files that are in the root directory.

EFS features

The Encrypting File System (EFS) is windows component, with the help of which information on the hard disk can be stored in an encrypted format. Encryption has become the strongest protection this operating system has to offer. In this case, encryption for the user is a fairly simple action, for this you just need to check the box in the properties of the folder or file. You can specify who can read such files. Encryption occurs when files are closed, and when they are opened, they are automatically ready for use.

RAW features

Data storage devices are the most vulnerable components that are most often prone to damage not only physically, but also logically. Certain hardware problems can be fatal, while others have solutions. Sometimes users have a question: "What is a RAW file system?"

As you know, to record any information on a hard disk or flash drive, the drive must have a file system. The most common are FAT and NTFS. And RAW is not even the file system that we usually imagine. In fact, this is a logical error already installed system, that is, its actual absence for Windows. Most often, RAW is associated with the destruction of the structure of the file system. After that, the OS does not just access data, but also does not display technical information by equipment.

Features of UDF

The Universal Disk Format (UDF) is designed to replace CDFS and add support for DVD-ROM drives. If we talk about what it is, then this is a new implementation old version for which meets the requirements It is characterized by certain features:

File names can be up to 255 characters long;

The name can be upper or lower case;

The maximum path length is 1023 characters.

Starting with Windows XP, this file system supports reading and writing.

This FS is used for flash drives, which are supposed to be used when working with different computers running different operating systems, in particular Windows and Linux. It was EXFAT that became the "bridge" between them, since it is able to work with data received from the OS, each of which has its own file system. What is and how it works will be clear in practice.

conclusions

As is clear from the above, each operating system uses specific file systems. They are intended for storing ordered data structures on physical media. If, when using a computer, you suddenly have a question about what the target file system is, then it is quite possible that when you try to copy a certain file to the media, you will see a message that the allowed size has been exceeded. That is why you need to know in which file system what file size is considered acceptable, so that you do not encounter problems when transferring information.

File management systems.

File system FAT... File systems VFATandFAT32.

1. Areas of a logical disk

2. Boot sector

3. File Allocation Table

4. Root directory

5.VFAT file system

6.FAT32 file system

In the FAT file system, the disk space of any logical disk is divided into two areas:

System area and

· Data area.

System area created and initialized upon formatting, and subsequently updated when manipulating the file structure.

The system area consists of the following components:

· The boot sector containing the boot record;

· Reserved sectors (they may not exist);

· File allocation tables (FAT, File Allocation Table);

Root directory (ROOT).

These components are located one after another on the disk.

Data area contains files and directories subordinate to the root.

Unlike the system area, the data area is accessible via user interface DOS.

Boot sector

Formation boot record occurs during formatting (e.g. FORMAT). The format of the boot sector depends on the OS and even the version.

The boot sector is the very first on the logical disk. It contains a boot record.

The boot record has two parts:

· Disk parameter block - often called. block bIOS settings (BPB) or Extended BPB (for older OS versions)

· OS bootstrap programs (system bootstrap).

The first two bytes of the boot record are the unconditional jump command to the boot loader - JMP 3Eh. The third byte contains NOP (90h).

This is followed by the disk parameters block, followed by the OS loader.

The disk parameter block contains the following information

Sector size,

The number of sectors in the cluster,

The number of reserved sectors,

Number of copies of FAT,

Maximum number of ROOT elements,

Number of sectors in the FAT table,

The number of sectors per track,

Volume label,

File system name

· And other parameters (byte-descriptor of the medium at offset 0Ah \u003d F8H - railway of any capacity; F0 - diskette 1.44, 3.5 '').

The boot records of different operating systems usually differ in the structure of the parameter block. Some also have additional fields.

We will get acquainted in detail with the boot record in laboratory work.

Between boot sector and FAT may contain reserved sectors that are service to the file system or are not used. The number of reserved sectors is defined in the BPB. (In aspect ratio - Reserved sectors at beginning -if \u003d 1, then it is MBR)

To view and edit, as well as save and restore the boot record, you can use utilityDisk Editor.

File Allocation Table

T file allocation table (File Allocation Table - FAT) is essentially a data area map.

The data area is divided into so-called clusters. A cluster is one or more contiguous sectors of a data area. On the other hand, a cluster is the smallest addressable unit of disk space allocated to a file. Those. the file or directory occupies an integer number of clusters. To create and write a new file to disk, the operating system allocates several free disk clusters for it. These clusters do not have to follow each other. For each file, a list of all cluster numbers that are provided to that file is kept.

On floppy disks, the cluster occupies one or two sectors, and on hard disks, depending on the volume of the partition:

for partitions with a capacity of 16-127 MB - 4 sectors in a cluster (cluster size - 2 Kbytes);

for partitions with a capacity of 128-255 MB - 8 sectors in a cluster (4 KB);

for partitions with a capacity of 256-511 MB - 16 sectors in a cluster (8 KB);

for partitions with a capacity of 512-1023 MB - 32 sectors in a cluster (16 KB);

for partitions with a capacity of 1024-2047 MB \u200b\u200b- 64 sectors in a cluster (32 KB).

Dividing the data area into clusters instead of using sectors allows:

· Reduce the size of the FAT table;

· Reduce file fragmentation;

Shortening the length of the file chains Þ file access is accelerated.

However, too large a cluster size leads to inefficient use of the data area, especially in the case of a large number of small files (after all, on average, half a cluster is lost per file).

In modern file systems (FAT32, HPFS, NTFS) this problem is solved by limiting the cluster size (maximum 4 KB)

Each element of the FAT table (12, 16 or 32 bits) corresponds to one disk cluster and characterizes its state: free, busy, or bad cluster.

· If the cluster is allocated to a file (i.e., busy), then the corresponding FAT element contains the number of the next file cluster;

· The last cluster of the file is marked with a number in the range FF8h - FFFh (FFF8h - FFFFh);

· If the cluster is free, it contains the zero value 000h (0000h);

· An unusable (bad) cluster is marked with the number FF7h (FFF7h).

Thus, in the FAT table, clusters belonging to the same file are linked into chains.

First FAT element describes the boot sector environment. Its first byte is the same as the media descriptor byte (offset0Ah - see Table 4) and is equal to0F0h for flexible magnetic 3.5 in. disk or0F8h for the hard drive. The next 5 bytes (7 bytes) for 12-bit (16-bit) format contain the value0FFh.

The file allocation table is stored immediately after the boot record of the logical disk, its exact location is described in a special field in the boot sector.

It is kept in two identical copies, which follow each other. When the first copy of the table is destroyed, the second is used.

Due to the fact that FAT is used very intensively when accessing disk, it is usually loaded into the RAM (in the I / O buffer or cache) and remains there for as long as possible.

The main disadvantage of FAT is slow work with files. When creating a file, the rule works - the first free cluster is allocated. This leads to disk fragmentation and complex file chains. Hence the slowdown in working with files.

To view and edit the FAT table, you can use utilityDisk Editor.

Root directoryROOT

The details of the file itself are stored in another structure called the root directory. Each logical drive has its own root directory (ROOT, English - root).

Root directory describes files and other directories. The directory entry is a file descriptor (descriptor).

Each file and directory descriptor includes it

Name (8 bytes)

Extension (3)

Date of creation or last modification (2)

Time of creation or last modification (2)

Attributes (1) (archive, directory attribute, volume attribute, system, hidden, read-only)

File length (for a directory - 0) (4)

A reserved field that is not used (10)

· Number of the first cluster in the chain of clusters assigned to a file or directory; Having received this number, the operating system, referring to the FAT table, finds out all the other cluster numbers of the file (2 bytes).

So, the user launches the file for execution. operating system searches for a file with the desired name by looking at the file descriptions in the current directory. When the required item is found in the current directory, the operating system reads the number of the first cluster of this file, and then the FAT table determines the remaining cluster numbers. Data from these clusters is read into RAM, being combined into one continuous section. The operating system transfers control to the file, and the program starts running.

To view and edit the root directory ROOT, you can also use utilityDisk Editor.

Comment. Recently, the volumes of disk mechanisms have far exceeded the maximum size acceptable for FAT - 8.4 GB. This limit is explained by the maximum possible values \u200b\u200bin the sector address, for which only 3 bytes are allocated. Therefore, in the overwhelming majority of cases, FAT is not used when working in Windows systems (either FAT32 or NTFS are used).

File systemVFAT

The VFAT (virtual FAT) file system first appeared in Windows for Workgroups 3.11 and was designed for file I / O in protected mode.

This file system is used in Windows 95. It is also supported in Windows NT 4.

VFAT is the native Windows95 32-bit file system. It is controlled by the VFAT.VXD driver.

Manages various file systems and applications the file system manager to install -Installable File Systems Manager.

VFAT uses 32-bit code for all file operations, can use 32-bit protected mode drivers.

BUT, file allocation table entries remain 12 or 16 bit, so the same data structure (FAT) is used on disk. Those. f table formatVFAT is the sameas is the FAT format.

VFAT along with the names "8.3" supports long filenames... (It is often said that VFAT is FAT with support for long names).

There is a special mechanism for converting long names to short ones and vice versa.

Remember that the length of the name for DOS obeys the rule “8.3”, that is, the length of the name must not exceed 8 characters,and extensions - 3. Main feature file systemWindows 95 for the user is that the maximum length of a filename in Windows 95 can be up to 256 characters, including spaces. The length of the file name is limited by the path to the file: the total length of the path and file name cannot exceed 260 characters.

When creating a file inWindows95 assigns it two names at once - long and short (8.3). A short name is formed from a long one by removing spaces and /: *? ““< > I. The eight-letter file name uses the first six remaining characters of the long name, the “~” (tilde) character and a sequence number. The three-letter extension uses the first three characters after the last period in the long file name.

For example, short names for files (in the following order)

Article about Windows 95.DOS

Next article about Windows 95.DOS

Article about Windows NT.DOS

Microsoft office.HTML

Microsoft Windows. Html

will look like this

In this case, in the ROOT structure, along with the usual descriptor (called alias) for a file or directory, descriptors of a special kind are created, in which a long name is stored. The special descriptors are set to Read Only, System, Hidden, Volume Label. The number of special descriptors depends on the length of the name.

The special descriptor refers to the cluster with number O. The real number of the first cluster allocated to a file or directory is in the standard (alias) descriptor located immediately after the special ones.

For VFAT volumes, you cannot use any utilities other than utilities that "understand" VFAT

The main disadvantage of VFAT is high clustering losses with large logical disk sizes and restrictions on the size of the logical disk itself.

File systemFAT32

This is a new implementation of the idea of \u200b\u200busing the FAT table.

FAT 32 is a completely self-contained 32-bit file system.

First used in Windows OSR2 (OEM Service Release 2).

FAT32 is currently used in Windows 98 and Windows ME.

It contains numerous improvements and additions over previous FAT implementations.

1. Much more efficient use of disk space due to the fact that it uses smaller clusters (4 KB) - it is estimated that it saves up to 15%.

2. Has an extended boot record that allows you to create copies of critical data structures Þ increases the resistance of the disc to violations of disc structures

3. Can use FAT backup instead of standard.

4. Can move the root directory, in other words, the root directory can be anywhere Þ removes the restriction on the size of the root directory (512 elements, since ROOT was supposed to occupy one cluster).

5. Improved the structure of the root directory

Additional fields have appeared:

Creation time (2)

Creation date (2)

Date of last access (2)

High word of the starting cluster number

The least significant word of the starting cluster number

· check sum

Multiple descriptors are still used for the long filename.

For FAT32 volumes, you cannot use any utilities other than utilities that "understand" FAT32