FAT32 version under NTFS. File system fat

Golovna / Troubleshooting

File systems FAT

FAT16

The FAT16 file system has been around since the early days of MS-DOS, and is supported by all Microsoft operating systems to ensure versatility. This name File Allocation Table clearly reflects the physical organization of the file system, the main characteristics of which include the maximum size of the volume that can be supported (hard disk or partition on the Orsk disk) does not transfer 4095 MB. During the hours of MS-DOS, 4 GB hard disks were sold out in bulk (larger disks with a capacity of 20-40 MB), so such a reserve was completely justified.

The volume of formats for the FAT16 vikoristan is divided into clusters. The size of the cluster depends on the size of the volume and can range from 512 to 64 KB. In the table Figure 2 shows how the size of the cluster depends on the size of the cluster. It is significant that the size of the cluster may vary depending on the values ​​of the calculations, but one of the values ​​​​in the table is to blame. 2.

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

FAT32

Starting with Microsoft Windows 95 OEM Service Release 2 (OSR2), Windows introduced support for 32-bit FAT. For systems based on Windows NT, this file system first began to be adopted by Microsoft Windows 2000. While FAT16 can support volumes up to 4 GB, FAT32 can support volumes up to 2 TB. The size of the FAT32 cluster can be changed from 1 (512 bytes) to 64 sectors (32 KB). To save the value of FAT32 clusters, 4 bytes are required (32 bits, not 16, like FAT16). This means that file utilities that are supported by FAT16 cannot be processed by FAT32.

The main difference between FAT32 and FAT16 is that it changes the size of the logical partition of the disk. FAT32 supports volume capacity up to 127 GB. In this case, if a FAT16 with 2 GB disks requires a cluster of 32 KB in size, then a FAT32 cluster with a size of 4 KB is suitable for disks with a volume of 512 MB to 8 GB (Table 4).

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

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

FAT32 imposes restrictions on the minimum size - there are no less than 65527 clusters. Given the size of the cluster, it is impossible for FAT to occupy more than 16 MB-64 KB/4 or 4 million clusters.

When different file names are used, the data required for access from FAT16 and FAT32 does not overlap. When creating a file with old names, Windows creates a separate name in 8.3 format and one or more entries to the directory to save the new name (13 characters each from the old file name on each entry). The skin entry saves the corresponding part of the file name in the Unicode format. Such entries contain the attributes “volume identifier”, “read only”, “system” and “accessions” - a set that is ignored by MS-DOS; This operating system has access to the file under its alias in 8.3 format.

File system NTFS

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

As with FAT, the main information unit of NTFS is the cluster. In the table 5 shows the size of clusters after washing for volumes of different capacities.

When formatting an NTFS file system, the formatting program creates a Master File Table (MTF) file and other metadata storage areas. Metadata is compiled into NTFS to implement the file structure. The first 16 entries in MFT are reserved by NTFS. Rotating metadata files $Mft and $MftMirr written to the original sector of the disk. If the first MFT entry is corrupted, NTFS reads another entry to find a copy of the first one. A complete copy of the preserved sector is placed on the side of the volume. In the table 6 The main metadata stored in MFT has been reworked.

Other MFT records place records for each file and directory located on this volume.

Consider one file with one record from MFT, if the file has a large set of attributes or becomes highly fragmented, then additional records may be needed to save information about it. In this case, the first record about the file, called the base record, saves the expansion of other records. Data about files and directories of small size (up to 1500 bytes) is always located in the first entry.

File attributes for NTFS

The same sector on the NTFS volume belongs to the same file. Pass file system metadata to a partial file. NTFS views each file (or directory) as a set of file attributes. Such elements as the name of the file, information about the protection and the data in the new file are attributes. The skin attribute is identified by a skin type code and, optionally, by the attribute name.

Since the attributes of a file are located in the file record, they are called resident attributes. Such attributes are used to indicate the file's name and the date of its creation. In these situations, if the information about the file is too large to fit into one MFT record, the file's attributes become non-resident. Resident attributes are stored in one or more clusters and there is a flow of alternative data for the stream volume (see below). To describe the location of resident and non-resident NTFS attributes, create the Attribute List attribute.

In the table 7 shows the main file attributes assigned to NTFS. The list may be expanded.

CDFS file system

Windows 2000 provides support for the CDFS file system, which conforms to the ISO'9660 standard that describes the distribution of information on a CD-ROM. All file names up to ISO'9660 Level 2 are supported.

When you create a CD-ROM for use under Windows 2000, please note:

  • All directory and file names must be at least 32 characters long;
  • All names of directories and files must consist of uppercase characters;
  • The depth of the catalogs may exceed 8 ranks from the root;
  • Various file name extensions are not obligatory.

Upgrading file systems

Under Microsoft Windows 2000, you can use the file systems FAT16, FAT32, NTFS or their combinations. The choice of operating system depends on the current criteria:

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

File systems FAT

As you may have already noted, the numbers in the names of the file systems - FAT16 and FAT32 - indicate the number of bits required to save information about the numbers of the clusters selected by the file. So, FAT16 has 16-bit addressing and, obviously, can be changed to 2-16 addresses. In Windows 2000, the first bits of the FAT32 file transfer table have necessary power requirements, while in FAT32 the number of addresses reaches 2 28.

In the table Figure 8 shows the size of clusters for FAT16 and FAT32 file systems.

In addition to the cost benefits of the FAT32 cluster size, it also allows the root directory to expand (FAT16 has a limited number of entries of 512 and can be lower if other file names are changed).

Advantages of FAT16

The average FAT16 variant can be called the following:

  • The file system is supported by MS-DOS, Windows 95, Windows 98, Windows NT, Windows 2000, and other UNIX operating systems;
  • There are a large number of programs that allow you to make changes to your file system and update data;
  • If you have problems with hard disk storage, the system may be connected to a floppy disk;
  • This file system is effective for volumes smaller than 256 MB.
Shortcuts FAT16

The main shortcomings of FAT16 include:

  • The root directory cannot contain more than 512 items. Changing old file names significantly reduces the number of these elements;
  • FAT16 supports no more than 65536 clusters, and since these clusters are reserved by the operating system, the number of available clusters is 65524. Each cluster has a fixed size for a given logical device. When the maximum number of clusters is reached at their maximum size (32 KB), the maximum volume that can be supported is 4 GB (under Windows 2000). To maintain functionality with MS-DOS, Windows 95 and Windows 98, volumes running FAT16 do not need to exceed 2 GB;
  • FAT16 does not support file protection or compression;
  • on large-volume disks, a lot of space is spent for the cost of using the maximum cluster. The location for the file appears depending on the size of the file and the cluster.
Advantages of FAT32

The meaning of FAT32 can be defined as follows:

  • Disk space consumption is more efficient, especially for high-volume disks;
  • The root directory in FAT32 is the primary cluster of clusters and can be located in any disk space. Therefore, FAT32 does not impose any restrictions on the number of elements in the root catalosis;
  • for smaller clusters (4 KB on disks up to 8 GB), the required disk space is 10-15% less than FAT16;
  • FAT32 is a more reliable file system. However, it supports the possibility of moving the root directory and vikoristan of the FAT backup copy. Moreover, the backup record will contain a number of data critical to the file system.
FAT32 shortcuts

The main disadvantages of FAT32:

  • volume size per hour using FAT32 under Windows 2000, 32 GB;
  • FAT32 volumes are not available from other operating systems - except Windows 95 OSR2 and Windows 98;
  • A backup copy of the private sector is not supported;
  • FAT32 does not support file protection or compression.

File system NTFS

When working in Windows 2000, Microsoft recommends formatting all hard disk partitions under NTFS, regardless of these configurations, if you are using a number of operating systems (except Windows 2000 and Windows NT). Using NTFS instead of FAT allows you to exploit the functions available in NTFS. Before them, zokrema, lie down:

  • Possibility of renewal. This capability is “infused” into the file system. NTFS guarantees data savings due to its use of the Vickory protocol and information updating algorithms. In case of system failure, the NTFS vikorist protocol and additional information for automatically updating the integrity of the file system;
  • squeeze of information. For NTFS volumes, Windows 2000 encourages compression of adjacent files. Such types of files can be processed by Windows add-ons without first unpacking, as they are automatically downloaded as soon as the file is read. When closed and saved, the file is packed again;
  • In addition, you can see the following advantages of NTFS:

Certain functions of the operating system will require NTFS access;

The flexibility of access is richer - NTFS minimizes the number of disk transfers required to find a file;

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

With NTFS installed, Windows 2000 supports volumes of up to 2 TB;

The file system maintains a backup copy of the private sector - it is located near the volume;

NTFS supports the Encrypted File System (EFS), which protects against unauthorized access to files;

Once you have a quota, you can limit the amount of disk space that your account occupies.

Shortcomings of NTFS

Speaking about the shortcomings of the NTFS file system, note that:

  • NTFS is not available in MS-DOS, Windows 95 and Windows 98. In addition, a number of functions implemented in NTFS under Windows 2000 are not available in Windows 4.0 and earlier versions;
  • For small volumes that can accommodate a lot of small files, there may be a decrease in productivity compared to FAT.

File system and speed

As we have already stated, for small volumes, FAT16 or FAT32 will provide increased access to files linked to NTFS, such as:

  • FAT has a more simple structure;
  • the size of the catalogs is smaller;
  • FAT does not support the protection of files from unauthorized access - the system does not need to check access rights for files.

NTFS minimizes the amount of data transfer to the disk and the time it takes to find a file. In addition, since the catalog size is small enough to fit into one MFT entry, the entire entry is read at once.

One input to FAT is to place the cluster number for the first cluster in the directory. To view a FAT file, you need to search the entire file structure.

The consistency of operations for directories that contain short and long file names must be ensured that the fluidity of operations for FAT depends on the operation itself and the size of the directory. When FAT looks for an irrelevant file, it searches for the entire directory - this operation takes more than an hour, based on the structure based on B-trees, which is compiled in NTFS. The average hour required by a file is expressed in FAT as a function of N/2, in NTFS as log N, where N is the number of files.

Low attack factors affect the speed of reading and writing files under Windows 2000:

  • File fragmentation. If the file is highly fragmented, NTFS requires less storage to the disk, and less FAT storage of all fragments;
  • Cluster size. For both file systems, the cluster size is determined to be part of the volume and is always expressed as a 2. Addresses in FAT16 are 16-bit, FAT32 are 32-bit, in NTFS are 64-bit;
  • According to FAT, the cluster size is based on the fact that the file distribution table can be no larger than 65,535 entries - the cluster size is a function of the volume volume divided by 65,535. more sheep for volume FAT , the lower the size of the cluster for that NTFS will be the same. It is important that the larger cluster size for FAT volumes means that FAT volumes can be less fragmented;
  • Rotating files of small size. When NTFS is installed, small files are stored in MFT records. The size of the file that can fit into one MFT record depends on the number of attributes of the file.

Maximum size of NTFS volumes

Theoretically, NTFS supports volumes with up to 232 clusters. In addition to the absence of hard drives, there are other restrictions on the maximum volume size.

One of these boundaries is the division table. Industry standards limit the size of the partition table to 232 sectors. Other dimensions include the sector size, which is 512 bytes. Some sector sizes can change in the future, the current size is limited to the size of one volume - 2 TB (231 x 512 bytes = 241). Thus, 2 TB is a practical limit for physical and logical NTFS volumes.

In the table Figure 11 shows the main NTFS interface.

Provide access to files and directories

On NTFS volumes, you can set access rights to files and directories. These access rights indicate which groups can access them and what level of access is permissible. Such access rights are extended both to users who work at the computer on which files are located, and to users who access files through a barrier, if the file is in a directory that is closed for remote access.

Under NTFS, you can also set permissions for remote access, which means access permissions to files and directories. Moreover, file attributes (only reading, accessing, system) also limit access to the file.

Under FAT16 and FAT32, you can also set file attributes, but you cannot ensure access rights to the files.

The NTFS version, which is used in Windows 2000, has a new type of access permission - reduced permissions. Security tab select option You can make any changes from parent to propagate to which object file, as he remains active in his mind. This option significantly speeds up the time when you need to change access rights to files and subdirectories. For example, to change access rights to a tree that contains hundreds of subdirectories and files, you just need to enable this option - in Windows NT 4 you need to change the attributes of each file and subdirectory.

In Fig. 5 shows the Properties dialog panel and the Security tab (Advanced section) – the file access rights have been expanded.

It is clear that for FAT volumes access can only be provided on equal volumes, and such control is only possible for remote access.

Compression of files and directories

Windows 2000 supports compression of files and directories located on NTFS volumes. These files are readable and writable by any Windows program. For which there is no need for it to be unpacked first. The compression algorithm is similar to that found in DoubleSpace (MS-DOS 6.0) and DriveSpace (MS-DOS 6.22), but has one main difference - under MS-DOS the compression of the entire primary partition is compressed more logical device, like under NTFS You can pack multiple files and directories.

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

Self-updating NTFS

The NTFS file system is self-updating and can maintain its integrity by following the protocol of concatenation actions and other mechanisms.

NTFS considers an operation that modifies system files on NTFS volumes as a transaction and stores information about such a transaction in the protocol. The started transaction can be completely completed (commit), or it can be abandoned (rollback). In the end, NTFS turns to the stage that transfers the transaction to the beginning. In order to handle transactions, NTFS records all operations that occur before the transaction in a protocol file, first writing to disk. After the transaction is completed, all operations are completed. Thus, under NTFS management there can be no unfinished operations. In case of disk failures, unfinished operations are simply lost.

Under NTFS servers there are also operations that allow you to identify defective clusters and introduce new clusters for file operations. This mechanism is called cluster remapping.

At this point we looked at the different file systems supported in Microsoft Windows 2000, discussed the features of each of them, and identified their advantages and disadvantages. The most promising is the NTFS file system, which has a large set of functions that are 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 the Win 2000 operating system is installed.

ComputerPress 7"2000

Extended attributes of all files.

VFAT

VFAT- This is an extension of FAT, which appeared in Windows 95. In FAT, file names are in 8.3 format and are made up of ASCII characters. VFAT now supports long (up to 255 characters) file names. Long File Name, LFN) in UTF-16LE encoding, in which LFN are stored simultaneously with names in 8.3 format, retrospectively called SFN (eng. Short File Name). LFNs are case-insensitive, however, when edited as SFNs, which are stored at upper case, LFNs preserve the case of characters indicated during file creation.

FAT system structure

In the FAT file system, adjacent sectors of the disk are combined into units, called clusters. The number of sectors in a cluster is at the level of two (div. distance). To save data to the file, a whole number of clusters (at least one) are entered, so, for example, if the file size is set to 40 bytes, and the cluster size is 4 kbytes, the file actually takes up less than 1% of the input data. Yes. To avoid such situations, completely change the size of clusters, and speed up the delivery of address information and increase the speed of file operations - for example. It's true to steal the song's compromise. So, since the disk capacity as a whole may not be expressed by the entire number of clusters, this is the case with the volume, i.e. surplus sectors - “surplus” of a size smaller than the cluster, which cannot be allocated by the OS to save information.

FAT32 is logically divided into three sub-areas:

  • Area reserved. Place service structures that belong to the partition boot record (PBR, subordinated to the Master Boot Record - the main partition of the disk; PBR is also often incorrectly called the backup sector) and correct it during initialization ii volumes;
  • An area of ​​the FAT table that contains an array of index indicators (“middles”) that represent data area clusters. Please note that the disk contains two copies of the FAT table with a reliability method;
  • The area of ​​data that is recorded directly instead of files - the text of text files, encoded images for baby files, digitized sound for audio files, etc. - as well as sound. metadata - information such as file names and folders, their attributes, time of creation and modification, size and location on disk.

FAT12 and FAT16 also have a special view of the root directory area. There are fixed positions (immediately after the remaining element of the FAT table) and fixed sizes of sectors.

If the cluster belongs to a file, then the last sequence will indicate the number of the corresponding cluster to the file. Since the file corresponds to the remaining cluster of the file, special values ​​must be used (FFFF 16 for FAT16). This is how the cluster of clusters in the file appears. Non-corresponding clusters in the table are assigned zeros. “Bad” clusters (those that are switched off during processing, for example, through unreading of the device’s dedicated area) also display a special code.

When a file is deleted, the first character of the name is replaced with a special code E5 16 and the cluster latch in the allocation table file is reset to zero. Some information about the size of the file (which is stored in the catalog with the file name) is lost incompletely, since the clusters of the file were reorganized on the disk sequentially and were not overwritten with new information Yes, it is possible to update the deleted file.

Zavantazhuvalny entry

The first structure of FAT is called BPB. BIOS parameter block ) it is located in the reserved area, in the zero sector. This structure contains information that identifies the file system type and the physical characteristics of the media (floppy disks or hard drive partitions).

BIOS Parameter Block

BPB was basically the same as FAT, which served MS-DOS 1.x, because at that time only two different types of volumes were transferred - one double-sided five-inch floppy disk of 360 kb, and the volume format was indicated after the first byte of the FAT area . BPB was introduced in MS-DOS 2.x as of 1983 because of the obov'yazkova structure of the private sector, which was followed by the volume format; The old scheme of assigning after the first byte of FAT has lost its support. Also, MS-DOS 2.0 introduced a hierarchy of files and folders (before this, all files were stored in the root directory).

The BPB structure in MS-DOS 2.x replaced the 16-bit "sector number" field, which meant that this version of FAT was not valid for volumes larger than 216 = 65536 sectors, then larger than 32 M b with a standard sector size of 512 bytes. In MS-DOS 4.0 (1988), the so-called BPB field was expanded to 32 bits, which meant an increase in the theoretical size to 232 = 4294967296 sectors, or up to 2 TB with a 512-byte sector.

The modification of BPB appeared immediately from Windows 95 OSR2, which was equipped with FAT32 (since 1996). Two gigabytes of space were allocated for the volume size, so FAT32 could theoretically accommodate up to 8 TB in size. However, the size of your skin file can exceed 4 GB. BIOS Parameter Block FAT32, due to its compatibility with earlier versions of FAT, repeats BPB FAT16 up to the BPB_TotSec32 field inclusive, then the following parameters are added.

The “Valuable Sector” of FAT32 actually has three 512-byte sectors - sectors 0, 1 and 2. From them, place the signature 0xAA55 behind the address 0x1FE, then in the remaining two bytes, since the size of the sector is still 512 bytes. If the sector size is larger, less than 512 bytes, then the signature is located at address 0x1FE, and at the remaining two bytes of the zero sector, so it is duplicated.

FSInfo

Vanguard entry to the FAT32 partition to place the structure under the name FSInfo, which is used to save the value of the number of good clusters. FSInfo, as a rule, occupies sector 1 (div. field BPB_FSInfo) and has an associated structure (addresses at the top of the sector):

  • FSI_LeadSig. 4-byte signature 0x41615252 indicates that the sector is being mapped 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 of the retouch at address 0x1E4 and place the value 0x61417272.
  • FSI_Free_Count. The four-byte field behind address 0x1E8 means that the number of free clusters in that volume remains visible to the system. The value 0xFFFFFFFF means that many of the free clusters are unknown and must be calculated.
  • FSI_Nxt_Free. The four-byte field behind the address 0x1EC contains the cluster number, which is responsible for the search of other clusters for the table of index indicators. Select this field to enter the number of the remaining FAT cluster assigned to the file. The value 0xFFFFFFFF means that the search for a valid cluster must be carried out from the beginning of the FAT table, or from another cluster.
  • FSI_Reserved2. A 12-byte field is reserved at address 0x1F0.
  • FSI_TrailSig. Signature 0xAA550000 - the remaining 4 bytes of the FSInfo sector.

The use of FSInfo in optimizing the work of the system means that the FAT32 table of index indicators can be of significant size and its byte-by-byte lookup can take a significant hour. However, the values ​​of the FSI_Free_Count and FSI_Nxt_Free fields may not be valid and must be checked for adequacy. In addition, they are not updated in the FSInfo backup copy, which is usually installed in sector 7.

Assigned to FAT volume type

Assigned to the FAT volume type (you can choose between FAT12, FAT16 and FAT32) the OS is generated for a number of clusters in the one that is assigned from the BPB fields. We first calculate the number of sectors in the root directory:

RootDirSectors = (BPB_RootEntCnt * 32) / BPB_BytsPerSec

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

The number of clusters in the data area is indicated:

CountofClusters = DataSec / BPB_SecPerClus

For a number of clusters, there is an unambiguous connection to 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 assign a FAT type. A piecemeal volume that violates the defined attribution rules, leading to incorrect Windows processing. Tim is not less, it is recommended to uniquely value CountofClusters, close to critical (4085 and 65525), for the correct assignment of the file system type, be it often incorrectly written drivers.

Over the years, FAT has become widely used in various devices including DOS, Windows, OS/2, Linux. Microsoft has not indicated any intention to license them [ clarify] .

In late 2009, Microsoft sued TomTom, a manufacturer of Linux-based car navigation systems, alleging infringed patents.

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 (6th 2000). - Documents in Microsoft Word format, 268 Kb. Archived
  4. What About VFAT? . TechNet Archive. Microsoft (June 15, 1999). Archived from Pershogerel on September 22, 2011. Revised 5th April 2010.
  5. Do not confuse the VFAT file system extension with the same file system driver that appears in Windows for Workgroups 3.11 and is used for processing calls with MS-DOS functions (INT 21h) in protected mode (div.: KB126746: Windows for Workgroups Version History. VERSION 3.11 → Non-Network Features. Microsoft (leaf fall 14, 2003). Archived from Pershogerel on September 22, 2011. Revised 5th April 2010.)
  6. Federal Patent Court Declares FAT patent of Microsoft null and void (English). heise online. Heise Zeitschriften Verlag (2nd February 2007). Archived
  7. Brian Kahin. Microsoft Roils the World with FAT Patents. The Huffington Post (10 February 2009). Archived from Pershogerel on September 22, 2011. Revised 10 February 2009.
  8. Ryan Paul. Microsoft suit over FAT patents could open OSS Pandora's Box (English). Ars Technica. Condé Nast Publications (25 February 2009). Archived
  9. Glyn Moody.(English). ComputerworldUK. IDG (5 February 2009). Archived from Pershogerel on September 22, 2011. Revised 9 February 2009.
  10. Steven J. Vaughan-Nichols. Linux company sign Microsoft patent protection pacts (English). Computerworld Blogs. IDG (5 February 2009). Archived from Pershogerel on September 22, 2011. Revised 9 February 2009.
  11. Erica Ogg. TomTom counterssues Microsoft in patent dispute. CNet (19 February 2009). Archived from Pershogerel on September 22, 2011. Revised 20 February 2009.

Posilannya

  • ECMA-107 (English) FAT standard

VOLODYMYR MISHKIV

FAT file system architecture

The hidden characteristics of the FAT file system. Structure of a partition using the FAT file system

The FAT (File Allocation Table) file system was developed by Bill Gates and Mark McDonald in 1977 and was initially used in the 86-DOS operating system. In order to achieve portability of programs from the CP/M operating system to 86-DOS, it retained the previously adopted file names. Then 86-DOS was added to Microsoft and became the basis of the MS-DOS 1.0 operating system, released in 1981. FAT is intended for working with small disks smaller than 1 MB and does not initially support hard disks.

The structure of the FAT section is depicted as a baby.

In the FAT file system, the disk space of a logical partition is divided into two areas - the system and data area (div. Fig. 1). The system area is created and initialized during formatting, and then updated during file structure manipulation. The system area of ​​FAT file systems consists of the following components:

  • original record (boot record, BR);
  • reserve galuz;
  • file allocation tables;
  • area of ​​the root directory (not relevant for FAT32).

The data area of ​​the logical disk contains files and directories, ordered by the root, and divided into sections of the same size - clusters. A cluster can be composed of one or many sectors sequentially placed on the disk. The number of sectors in a cluster can be a multiple of 2N and can range from 1 to 64. The size of the cluster depends on the type of file system used and the type of logical disk.

Purpose, structure and type of file allocation table

FAT got its name from its single-name file allocation table – File Allocation Table, FAT. The file allocation table stores information about the logical disk clusters. Each cluster is represented by an element of the FAT table, which contains information about the particular data cluster or data occupied by the file. If the cluster is assigned to a file, then the corresponding element of the file allocation table indicates the address of the cluster to place such part of the file. The number of the seed cluster occupied by the file is stored in the directory entry to record the file. The remaining element of the list of clusters contains the end of file sign (EOF – End Of File). The first two FAT elements are reserved.

The FAT file system fills up the available space on the disk from start to finish. When a new or larger file is created, the first large cluster in the file allocation table is searched. If during the process some files were deleted and others changed in size, the resulting empty clusters will be scattered across the disk. If the clusters that contain data to the file are not fully grown, the file appears fragmented.

There are such types of FAT – FAT12, FAT16, FAT32. The names of FAT types are based on the size of the element: a FAT12 element is 12 bits (1.5 bytes), FAT16 – 16 bits (2 bytes), FAT32 – 32 bits (4 bytes). In FAT32, the upper two bits are reserved and ignored during the operation of the operating system.

Root catalog

The file allocation tables are followed by the root directory. Each file and subdirectory in the root directory is represented by a 32-byte directory entry that contains the file name, its attributes (archive, archived, system and read-only), date and time of creation (or entered before remaining changes), as well as other information. For FAT12 and FAT16 file systems, the position of the root directory on the partition and its size is strictly fixed. In FAT32, the root directory can be expanded to suit any data area of ​​the section and be of a sufficient size.

File name formats

One of the characteristics of earlier versions of FAT (FAT12 and FAT16) is the use of short file names. In short, the name consists of two fields - an 8-byte field to accommodate the file name, and a 3-byte field to accommodate the extension ("8.3" format). If the entered file name is shorter than 8 characters, it will be supplemented with spaces (code 0x20); If an extension shorter than three bytes is entered, it is also supplemented with spaces.

The structure of the directory element for a short file name is presented in Table 1.

The first byte of the short name corresponds to the directory busy sign function:

  • If the first byte is higher than 0xE5, then the directory element is free and can be changed when a new file is created;
  • If the first byte is higher than 0x00, then the directory element is empty and is the beginning of a clean area in the directory (after which there is no additional element).

Table 1. Structure of the short file name directory element

Substitution

Size (byte) Zmist
0x00 11 Short file name
0x0B 1 File attribute
0x0C 1 Reservations for Windows NT.
0x0D 1 A field that specifies the hour the file was created (maybe tens of milliseconds). The field is only cleared for FAT32
0x0E 1 It's time to create the file. The field is only cleared for FAT32
0x10 2 Date the file was created. The field is only cleared for FAT32
0x12 2 The date of the last publication in the file for recording and reading the data. The field is only cleared for FAT32
0x14 2 The older word is the number of the first cluster in the file. The field is only cleared for FAT32
0x16 2 Time for the remaining operation to write to the file
0x18 2 Date of the last operation recorded in the file
0x1A 2 Younger word number of the first cluster file
0x1C 4 File size in bytes

The number of ASCII characters in a short name is superimposed with a low boundary:

  • it is not possible to substitute characters with codes less than 0x20 (except for code 0x05 in the first byte of the short name);
  • it is not possible to vicorize symbols with codes 0x22, 0x2A, 0x2B, 0x2C, 0x2E, 0x2F, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x5B, 0x5C, 0x5D;
  • It is not possible to add a space character (0x20) to the first byte of the name.

For file systems FAT32 and VFAT (virtual FAT, extension of FAT16) support for long file names (LFN) is enabled. To preserve a long-lasting name, select elements in the catalog that are combined with the main element. The file name is written not in ASCII characters, but in Unicode. In one directory element you can save a fragment of up to 13 Unicode characters. The new section of the remaining fragment will be filled with codes 0xFFFF. The structure of the directory element for a long file name is presented in Table 2.

Table 2. Structure of the directory element of the long file name

Substitution Size (byte) Zmist
0x00 1 Fragment number
0x01 10 Characters 1-5 of the file name in Unicode
0x0B 1 File attribute
0x0C 1 Prapori byte
0x0D 1 Short name control amount
0x0E 12 Characters 6-11 of the file name in Unicode
0x1A 2 Number of the first cluster (filled with zeros)
0x1C 4 Characters 12-13 of the file name in Unicode

Zavantazhuvalny sector

The first sector of the logical disk using the FAT system is assigned a private sector and a block of BIOS parameters. The cob plot of this block is identical for all types of FAT (Table 3). The values ​​of the structure of important sectors for different FAT types begin at offset 0x24. For FAT12 and FAT16, the structure appears as shown in Table 4, for FAT32 – in Table 5.

Table 3. Pochatkova plot of the vantage sector

Substitution Size, byte Description
0x00 3 Crazy transition (jmp) to awesome code
0x03 8 Producer company identifier
0x0B 2 Number of bytes in a sector (512)
0x0D 1 Number of sectors in a cluster
0x0E 2 The number of reserve sectors in the reserve area of ​​the section, starting from the first sector I will separate
0x10 1 Number of tables (copies) FAT
0x11 2 For FAT12/FAT16 – a number of 32-byte file descriptors in root catalosis; for FAT32 this field has a value of 0
0x13 2 The number of sectors in a section is limited; if this field is 0, then the number of sectors is specified by the offset field 0x20
0x15 1 Type of wear. For a hard disk the value is 0xF8; for a compact disk (2 sides, 18 sectors per road) – 0xF0
0x16 2 For FAT12/FAT16, this field contains a number of sectors, borrowing one copy of FAT; for FAT32 this field has a value of 0
0x18 2 Number of sectors on the road (for interchange 0x13)
0x1A 2 Number of working surfaces (for reworking 0x13)
0x1C 4 Number of sectors admitted before division
0x20 4 The number of sectors in a section is limited. The field is selected according to the section over 65535 sectors, otherwise the field should be 0.

Table 4. Structure of the mining sector FAT12/FAT16

Substitution Size, byte Description 0x24 1 The disk drive number for re-rendering is 0x13 0x25 1 0x26 1 Sign of the expanded vantage record (0x29) 0x27 4 Logical drive number 0x2B 11 Disc label 0x36 8 Text row with abbreviation for file system type

Table 5. Structure of the vanguard sector FAT32

Size, byte Description 4 Number of sectors occupied by one copy of FAT 2 Active FAT number 2 FAT32 version number: high byte – version number,junior – revision number. At the given hour the value is 0:0 4 Cluster number for the first cluster in the root directory 2 Sector number of the FSINFO structure of the backup area of ​​the logical disk 2 Sector number (in the reserve area of ​​the logical disk) that is being analyzedto save a backup copy of the backup sector 12 Reserved (revenge 0)

Substitution
0x24
0x28
0x2A
0x2С
0x30
0x32
0x34

In addition to what is listed in the tables of the 2nd and 3rd fields, the zero sector of the logical disk is responsible for the code 0x55 in the bytes with displacement 0x1FE, and the code 0xAA for the next byte (displacement 0x1FF). Two bytes are designated as the sign of the grinding disk.

Thus, the protected sector performs two important functions: it determines the structure of data on the disk, and also allows you to protect the operating system.

On a logical disk with FAT32 organization, there is an additional FSInfo structure, which is located in the first sector of the backup area. This structure contains information about the number of free clusters on the disk and the number of the first free cluster in the FAT table. The structure format is described in Table 6.

Table 6. Structure of the FSInfo sector and the reserve vanguard sector FAT32

Size, byte Description 4 The value 0x41615252 is a signature that indicates that this sector contains the FSInfo structure 480 Reserved (revenge 0) 4 Value 0x61417272 (signature) 4 Place a number of free clusters on the disk. If the field contains the value 0xFFFFFFFF, then the number of large clusters is unknown and must be calculated 4 Enter the number of the cluster for which the driver is responsible for starting the search for new clusters. If the field contains the value 0xFFFFFFFF, to find more clusters you need to start with cluster number 2 12 Reserved (revenge 0) 4 Signature 0xAA550000 – sign of the end of the FSInfo structure

Substitution
0x000
0x004
0x1E4
0x1E8
0x1EC
0x1F0
0x1FC

To access a file located on a partition with the FAT file system, you must assign the number of the first cluster to the file. This number, as we have already installed, enters the item's storage directory to record the file. The number of the first cluster indicates the FAT table element in which the cluster addresses are stored for each part of the file. The FAT element, which represents the remaining cluster in the lanyard, places the signature of the end of the file. For FAT12 the value should be set to 0xFFF, for FAT16 – 0xFFFF, for FAT32 – 0xFFFFFFFF.

Let's look at the software implementation of the FAT skin type reading algorithm, and finally with FAT16.

All published texts that appear in the article are available on the journal’s website.

Software implementation of the algorithm for reading a file from a logical partition from the FAT16 file system

We are developing a module that reads the first N clusters of a file created on a partition with the FAT16 file system. Parameter N (number of clusters to read) is a variable value and is set by the user. The file name corresponds to the “8.3” format, then. є short. The module operates under Linux OS.

Essential header files:

#include

#include

#include

#include

#include

#include "split.h"

The header file split.h contains the following:

#include

#define SHORT_NAME 13 // maximum length of short file name

struct split_name(

U8 name; // file name

U8 ext; // file extension

Int name_len // add file name

Ext_len; // Extend file extension

The split_name structure is intended to save the storage parts of the short file name (name and extension) and their parts.

The header file is assigned structural types that describe the main components of the FAT file system - the private sector, the FSInfo sector, directory element structures for short and long file names.

Let's take a brief look at the fields that extend to the skin of these structures.

    1. Structure of the fat sector struct fat_boot_sector:
      • __s8 system_id– system identifier;
      • __u8 sector_size - sector size in bytes;
      • __u8 cluster_size- Cluster size in sectors;
      • __u16 reserved- The number of reserve sectors in the reserve area of ​​the section;
      • __u8 fats– number of FAT copies;
      • __u8 dir_entries– the number of 32-byte file descriptors in the root directory;
      • __u8 sectors- Number of sectors per section; If the field is 0, the total_sect field is vikoriated;
      • __u8 media– type of device on which the file system was created;
      • __u16 fat_length– size of FAT in sectors;
      • __u32 total_sect- Size of the FAT partition in sectors (since the sectors field == 0).
      • __u32 fat32_length– FAT32 size for sectors;
      • __u32 root_cluster- Number of the first cluster in the root directory;
      • __u16 info_sector- Sector number to be entered into the FSInfo structure.

The following fields of this structure are used only in FAT32:

  1. Sector structure FSInfo struct fat_boot_fsinfo:
    • __u32 signature1- signature 0x41615252;
    • __u32 signature2- signature 0x61417272;
    • __u32 free_clusters– number of free clusters. If the field is set to -1, search for more clusters after starting from cluster number 2.
  2. The structure of the short name directory element struct msdos_dir_entry:
    • __s8 name,ext- I have expanded the file;
    • __u8 attr- File attribute;
    • __u8 ctime_ms– this field specifies the hour the file was created to ms (Vikorist only FAT32);
    • __u16ctime- time to create the file (only FAT32);
    • __u16 date– date the file was created (only FAT32);
    • __u16 date– date of remaining access to the file (only FAT32);
    • __u16 starthi- Higher 16 bit numbers of the first cluster in the file (only FAT32 ones are reviewed);
    • __u16 time,date,start– hour and date of creation of the file, number of the first file in the cluster;
    • __u32 size- File size (in bytes).
  3. Structure of the long-name directory element:
    • __u8 id- Item number;
    • __u8 name0_4– symbols 1 – 5 names;
    • __u8 attr- File attribute;
    • __u8 alias_checksum- Short name control sum;
    • __u8 name5_10- Symbols 6 - 11 names;
    • __u8 name11_12– symbols 12 – 13 names.

Let’s continue with a look at the software implementation of the algorithm and what is important is the partition on which the FAT16 file system is created:

#ifndef FAT16_PART_NAME

#define FAT16_PART_NAME "/dev/hda1"

#endif

Global structures:

struct fat_boot_sector fbs; // structure of the vanguard sector

struct msdos_dir_entry dentry; // Structure of the directory element

Global changes:

U16*fat16; // copy the FAT16 table here

U16 sector_size; // Sector size (with FAT16)

U16 dir_entries; // Number of 32-byte descriptors

// at root-catalyst (0 for FAT32)

U16 sectors; // limited number of sectors in a section

U32 fat16_size; // size FAT16

U32 root_size; // Size of the root directory

U16 byte_per_cluster; // Cluster size in bytes

U16 next_cluster; // chergovy cluster at lantsyuzhku

int fat;

Let's take a look at the head function:

int main()

Int num;

Specify a file name instead of what you want to read. I'll guess what we're doing with short file names. The order of work with long names of this article is not clear.

U8 *full_path = "/Folder1/Folder2/text.txt";

Let's open the attached file:

Hard = Open(FAT16_PART_NAME, O_RDONLY);

If(hard< 0) {

Perror(FAT16_PART_NAME);

Exit(-1);

The first 10 clusters in the file are read. The function fat16_read_file() is used to read the icon. The function parameters are outside the file name and the number of clusters for reading. The function rotates the number of read clusters or -1, if the reading time has become smaller:

Num = fat16_read_file(full_path, 10);

If(num< 0) perror("fat16_read_file");

Else printf("Read %d clusters", num);

I'll close the file and attach it:

Close(hard);

Return 0;

The function for reading clusters in a file looks like this:

int fat16_read_file(__u8 *full_path, int num)

Struct split_name sn; // structure for storing storage parts of the file

U8 tmp_name_buff; // buffer for time-to-hour saving of warehouse elements for permanent storage of the file

Static int i = 1;

Int n;

U8 * tmp_buff;

U16 start_cluster, next_cluster;

The function parameters were changed when looking at the main function.

Preparatory operation – the tmp_name_buff buffer and the struct split_name sn structure are reset:

The first character in the absolute pathname of a file is a forward slash (/). Let's check this:

Considered in this section is the vantage sector:

If(read_fbs()< 0) return -1;

The important sector is now located in the global structure struct fat_boot_sector fbs. We copy from this structure the size of the sector, the number of records in the root directory and the number of sectors per partition:

The size of the cluster in bytes is significant:

Byte_per_cluster = fbs.cluster_size * 512

Here is some information available to the jewelry sector:

Printf("System id - %s", fbs.system_id);

Printf("Sector size - %d", sector_size);

Printf("Cluster size - %d", fbs.cluster_size);

Printf("Reserved - %d", fbs.reserved);

Printf("FATs number - %d ",fbs.fats);

Printf("Dir entries - %d", dir_entries);

Printf("Sectors - %d", sectors);

Printf("Media - 0x%X", fbs.media);

Printf("FAT16 length - %u", fbs.fat_length);

Printf("Total sect - %u", fbs.total_sect);

Printf("Byte per cluster - %d", byte_per_cluster);

We calculate the size of FAT16 in bytes and read it:

Fat16_size = fbs.fat_length * 512;

If(read_fat16()< 0) return -1;

Read the root directory:

If(read_root_dentry()< 0) return -1;

This will show the dir_entry positioning on the memory area to place the entry in the root directory. The size of this memory area is equal to the size of the root directory (root_size).

Save (for control) instead of the root directory in the accompanying file:

#ifdef DEBUG

Close(fat);

#endif

Let's calculate the beginning of the data area:

Data_start = 512 * fbs.reserved + fat16_size * fbs.fats + root_size;

If all entries are in the root directory, we can locate them in the file test.txt. With this method we organize a cycle. In this cycle, we will analyze the file name, seeing its elements - subdirectories (we have two of them, Folder1 and Folder2) and the file name (test.txt).

While(1) (

Memset(tmp_name_buff, 0, SHORT_NAME);

Memset((void *)&sn, 0, sizeof(struct split_name));

For(n = 0; n< SHORT_NAME; n++, i++) {

If((tmp_name_buff[n] == "/") || (tmp_name_buff[n] == "?")) (

I++;

Break;

Tmp_name_buff[n] = "?";

We fill the struct split_name sn structure with additional information. The split_name function has been updated, in which the file name is verified to match the “8.3” format:

< 0) {

Printf("not valid name ");

Return-1;

For the skin element, the common name for the file is the cob cluster. For this purpose, we look in the directory elements (starting from the root) for an entry that corresponds to the element's real name, and read this entry. The search procedure is completed by the get_dentry() function:

If(get_dentry(&sn)< 0) {

Printf("No such file!");

Return-1;

We check the file attributes. Since this is a directory, we read it instead and continue the cycle:

If(dentry.attr & 0x10) (

If(read_directory(dentry.start)< 0) return -1;

Continue;

As a file, the first num clusters are read. To control the treated information, it is saved in a separate file:

If(dentry.attr & 0x20) (

Start_cluster = dentry.start;

Tmp_buff = (__u8 *) malloc (byte_per_cluster); // read here instead of the cluster

N = open("clust", O_CREAT | O_RDWR, 0600); // This file's information is carefully disinfected

If(n< 0) {

Perror("open");

Return-1;

To read clusters in a file, we organize a cycle:

For(i = 0; i< num; i++) {

We read the cluster into the tmp_buff buffer and save it in a separate file:

< 0) return -1;

< 0) {

Perror("write");

Close(n);

Return-1;

The number of the attack cluster occupied by this file is read from FAT16. As a result of the remaining cluster, we interrupt the cycle and turn to the main function:

#ifdef DEBUG

Printf("OK. Readed");

Printf("file`s next cluster - 0x%X..", next_cluster);

#endif

If(next_cluster == EOF_FAT16) (

#ifdef DEBUG

Printf("last cluster.");

#endif

Free(tmp_buff);

Close(n);

Return ++i;

#ifdef DEBUG

Printf("stop reading");

#endif

Return i;

Reading the FAT16 sector is modified by the read_fbs() function. The result is located in the global fbs structure:

int read_fbs()

If(read(hard,(__u8 *)&fbs, sizeof(fbs))< 0) return -1;

Return 0;

To read the file allocation table of the FAT16 file system, use the read_fat16() function:

int read_fat16()

U64 seek = (__u64) (fbs.reserved) * 512; // Shift to FAT16 in the first section

Fat16 = (void *) malloc(fat16_size);

If(pread64(hard, (__u8 *)fat16, fat16_size, seek)< 0) return -1;

Return 0;

The read_root_dentry() function is used to read the root directory:

int read_root_dentry()

U64 seek = (__u64) fbs.reserved * 512 + fat16_size * fbs.fats; // Replacement to the root directory in the first section

Root_size = 32* dir_entries; // calculate the size of the root directory

Dir_entry = (__u8 *) malloc (root_size);

If(!dir_entry) return -1;

Memset(dir_entry, 0, root_size);

If(pread64(hard, dir_entry, root_size, seek)< 0) return -1;

Return 0;

Reading the cluster that belongs to the file is specified by the read_cluster() function. The input parameters of the function are the cluster number cluster_num and the input to the buffer __u8 *tmp_buff, where the reading result should be placed. Displacements to a cluster in a partition are calculated using the following formula (div.):

SEEK = DATA_START + (CLUSTER_NUM - 2) * BYTE_PER_CLUSTER,

  • SEEK- Displacement to cluster on partition
  • DATA_START- Data area cob
  • CLUSTER_NUM– cluster serial number
  • BYTE_PER_CLUSTER- Cluster size in bytes

int read_cluster(__u16 cluster_num, __u8 *tmp_buff)

U64 seek = (__u64) (byte_per_cluster) * (cluster_num - 2) + data_start; // calculate zsuv to cluster

< 0) return -1;

Return 0;

The read_directory function confines the read entries to the directory (not the root directory) and places the result in the memory area, as the dir_entry index has been adjusted:

int read_directory(__u16 start_cluster)

Int i = 1;

U16 next_cluster;

For(; ;i++) (

We can see the memory for saving in the directory, read in place of the start cluster and read from the FAT16 table the values ​​of the start cluster:

If(!dir_entry) return -1;

< 0) return -1;

Next_cluster = fat16;

Saved instead of a directory in a separate file (for control):

#ifdef DEBUG

Printf("Next cluster - 0x%X", next_cluster);

Fat = open("dir16", O_CREAT | O_WRONLY, 0600);

Write(fat, dir_entry, root_size);

Close(fat);

#endif

Once the remaining cluster is reached, we exit the loop, otherwise we continue to read the directory, increasing the size of the dir_entry buffer by one more cluster:

If(next_cluster & EOF_FAT16) break;

Start_cluster = next_cluster;

Return 0;

The get_dentry() function searches for the directory of the element that corresponds to the file. The input parameters of this function are the structure indicator struct split_name *sn, which places the elements of the short file name:

Int i = 0;

The global buffer dir_entry contains an array of elements in the directory in which we select the entry for the file (or directory). To search, we organize a cycle. This cycle is working to copy the elements of the directory into the global dentry structure and equalize the values ​​of the name and ext fields of the structure with the related fields of the struct split_name *sn structure. The absence of these fields means that we have found an entry for the searched file in the array of elements in the directory:

for(; ; i++) (

If(!(memcmp(dentry.name, sn->name, sn->name_len)) &&

!(memcmp(dentry.ext, sn->ext, sn->ext_len)))

Break;

If(!dentry.name) return -1;

#ifdef DEBUG

Printf("name - %s", dentry.name);

Printf("start cluster - 0x%X", dentry.start);

Printf("file size - %u", dentry.size);

Printf("file attrib - 0x%X", dentry.attr);

#endif

Return 0;

All guidance code is located in the FAT16 catalog, file fat16.c. To create a new module, create a Makefile like this:

INCDIR = /usr/src/linux/include

PHONY = clean

Fat16: fat16.o split.o

Gcc -I$(INCDIR) $^ -g -o $@

%.o: %.c

Gcc -I$(INCDIR) -DDEBUG -c $^

Clean:

Rm -f*.o

Rm-f./fat16

Software implementation of the algorithm for reading a file from a logical partition from the FAT12 file system

The algorithm for reading a file with a FAT12 partition is identical to the algorithm for reading a file with a FAT16 partition. The importance lies with the procedure for reading elements from the FAT12 table. The FAT16 table was viewed as a simple array of 16-bit elements. To read the elements of the FAT12 table, the following algorithm is applied:

  • multiply the element number by 1.5;
  • pull a 16-bit word from FAT, vikorista as the result of the previous operation is displaced;
  • If the element number is different, perform the AND operation on the treated word and the mask 0x0FFF. If the number is unpaired, destroy the word in the table by 4 bits in the lower ranks.

Based on this algorithm, we implement the function of reading elements from the FAT12 table:

int get_cluster(__u16 cluster_num)

U16 seek;

U16 clust;

The offsets are calculated from the FAT12 table and a 16-bit word is read from the table:

Seek=(cluster_num*3)/2;

Memcpy((__u8 *)&clust, (__u8 *)(fat12 + seek), 2);

If the starting number of the cluster is the same number, the value read from the table is destroyed by 4 bits from the lowest digits, and if it is not the same number, it is assumed to be 0x0FFF:

If(cluster_num % 2) clust >>= 4;

Else clust &= 0x0FFF;

This fragment can also be implemented in assembly language:

" xorw %%ax, %%ax "

" btw $0, %%cx "

"jnc 1f"

" shrw $4, %%dx "

"jmp 2f"

"1: andw $0x0FFF, %%dx "

"2: movw %%dx, %%ax "

:"=a" (next)

: "d" (clust), "c" (cluster_num));

Let's turn the result:

Returnclust;

We'll spend a little time reporting on the algorithm. Let’s assume that a file has been created on a FAT12 partition that occupies the 9th and 10th clusters. The FAT12 skin element takes up 12 bits. Because From the table we count 16-bit elements, then shifting to the 9th element adds 13 bytes (9 * 1.5 = 13, the excess is thrown away), with the youngest 4 digits lying on the 8th FAT element. They need to be thrown out, and then the treatment element must be destroyed by 4 bits from the younger discharges, as transmitted by the algorithm. The displacement up to the 10th element is 15 bytes, and the most significant 4 bytes are in the 11th FAT element. To remove them, you must exit the AND operation on the 10th element and the mask 0x0FFF, which corresponds to the above algorithm.

The output texts of the module reading a file from the FAT12 section are located in the FAT12 directory, file fat12.c.

Software implementation of the algorithm for reading a file from a logical partition from the FAT32 file system

The algorithm for reading a file in a partition with the FAT32 file system practically does not differ from the algorithm for FAT16, except that the FAT32 root directory can be expanded into any partition and therefore of a larger size. Therefore, in order for it to be more straightforward, it is acceptable that we only know the number of the partition with the FAT32 file system. To obtain information from this section, determine its coordinates – displacement to the section of the disk. And for this mother’s need, the statement about the logical structure of the hard disk.

Logical hard drive structure

Let's take a look at the logical structure of the hard drive, which corresponds to the Microsoft standard - "main section - extension sections - non-DOS sections."

The space on your hard drive can be organized into one or several sections, and the sections can accommodate one or more disks.

On the hard drive, behind the physical address 0-0-1, there is a Master Boot Record (MBR). The MBR structure has the following elements:

  • non-system bootstrap (NSB);
  • table describing disk partitions (partition table, PT). Expanded to MBR at offset 0x1BE and takes 64 bytes;
  • MBR signature. The remaining two bytes of the MBR are responsible for the number 0xAA55.

The partition table shows the location and characteristics of the partitions found on the hard drive. Disk partitions can be of two types – primary (primary, main) and extended (extensions). The maximum number of primary partitions is the same. There should be one primary partition on the disk and the primary partition. An extended partition can be divided into a large number of sub-partitions – logical drives. The simplified structure of the MBR is presented in Table 7. The table of partitions is expanded like the MBR; 16 bytes are provided to describe the partition of the table.

Table 7. MBR structure

Substitution Size, byte 0 446 0x1BE 16 0x1CE 16 0x1DE 16 0x1EE 16 0x1FE 2

The structure of the section table element entry is shown in Table 8.

Table 8. Structure of a section table element entry

Substitution Size, byte Zmist
0x00 1 Activity sign (0 – section not active, 0x80 – section active)
0x01 1 Number of the disk head where the section begins
0x02 2 Cylinder number and sector number from which the section begins
0x04 1 Partition type code System ID
0x05 1 Number of the disk head where the partition will end
0x06 2 Cylinder number and sector number where the section will end
0x08 4 Absolute (logical) number of the cob sector of the section
0x0C 4 Section size (number of sectors)

The first byte of the section element indicates the activity of the section (0 – inactive, 0x80 – active). It is important to note the importance of the system backup section and the need to restart the operating system when starting the computer. Only one section can be active. Following the section activity sign are the coordinates of the section head - three bytes, which indicate the head number, sector number and cylinder number. The numbers of the cylinder and sector are specified in the format of the transfer Int 0x13, then. bits 0-5 are the sector number, bits 6-7 are the highest two bits of the 10-digit cylinder number, bits 8-15 are the lowest bits of the cylinder number. Then follows the System ID code, which indicates that this section belongs to the same operating system. The identifier takes up one byte. Behind the system identifier, the coordinates of the end of the section are expanded - three bytes that contain the numbers of the head, sector and cylinder. The current bytes are the number of sectors before the section, and the remaining bytes are the size of the sector.

In this way, a section table element can be described using the following structure:

struct pt_struct (

U8 bootable; // ensign of activity for the section

U8 start_part; // coordinate to the cob section

U8 type_part; // system identifier

U8 end_part; // coordinates of the end of the section

U32 sect_before; // Number of sectors before partition

U32 sect_total; // Size of the section in sectors (number of sectors for the section)

The element of the primary partition indicates the protected sector of the logical disk (the primary partition always has one logical disk), and the element of the extended partition indicates the list of logical disks, composed of structures called secondary MBRs (Secondary MBR, ).

Its SMBR block is located at the skin disc of an expanded section. SMBR has a structure similar to MBR, except that it contains a record for a new day (filled with zeros), and from four fields of describing sections only two are selected. The first element of the partition indicates the logical disk, the other element indicates the next SMBR structure of the list. In the remaining SMBR list, assign a zero section code to another element.

Let's turn to look at the file reading module for the FAT32 partition.

Header files:

#include

#include

#include

#include

#include

MBR signature:

#define SIGNATURE 0xAA55

I will attach the file for information about the sections:

#define DEVICE "/dev/hda"

Partition table element size (16 bytes):

#define PT_SIZE 0x10

The next array of structures establishes the type between the code, section type and symbolic representations:

struct systypes (

U8 part_type;

U8 * part_name;

struct systypes i386_sys_types = (

(0x00, "Empty"),

(0x01, "FAT12"),

(0x04, "FAT16<32M"},

(0x05, "Extended"),

(0x06, "FAT16"),

(0x0b, "Win95 FAT32"),

(0x0c, "Win95 FAT32 (LBA)"),

(0x0e, "Win95 FAT16 (LBA)"),

(0x0f, "Win95 Ext"d (LBA)"),

(0x82, "Linux swap"),

(0x83, "Linux"),

(0x85, "Linux extended"),

(0x07, "HPFS/NTFS")

The number of elements in the i386_sys_types array is significant behind the additional macro PART_NUM:

#define PART_NUM (sizeof(i386_sys_types) / sizeof(i386_sys_types))

Installation of interchange for a number of logical disks:

#define MAX_PART 20

The following array of structure contains information about the logical drives on the device (hard drive):

struct pt_struct (

U8 bootable;

U8 start_part;

U8 type_part;

U8 end_part;

U32 sect_before;

U32 sect_total;

) pt_t;

int hard; // attach file descriptor

U8 mbr; // MBR is important here

Partition number on which the FAT32 file system is created:

#define FAT32_PART_NUM 5

Structures of the private sector, FSInfo sector and directory elements (assigned to the file ):

struct fat_boot_sector fbs;

struct fat_boot_fsinfo fsinfo;

struct msdos_dir_entry dentry;

U32 * fat32 = NULL; // copy the FAT32 table here

U16 sector_size; // Sector size (from FAT32)

U16 dir_entries; // 0 for FAT32

U16 sectors; // Number of sectors per partition

U32 fat32_size; // size FAT32

U32 data_start; // head of the data area

U16 byte_per_cluster; // how many bytes does the cluster have (cluster size in bytes)

U32 next_cluster; // chergovy cluster at lantsyuzhku

U32 root_cluster; // ROOT cluster - cob cluster of the root directory

U8 * dir_entry = NULL; // indicator on the directory entry

U64 start_seek = 0; // start offset to bottom (in bytes)

Main function:

int main()

Int num = 0;

Int cluster_num = 5; // how many clusters to read from the file

U8 * full_path = "/Folder1/Folder2/readme"; // file to read

Opening the device, selecting information about the partition table on the device and displaying information about the partitions:

Hard = Open(DEV_NAME, O_RDONLY);

If(hard< 0) {

Perror(DEV_NAME);

Exit(-1);

If(get_pt_info(hard)< 0) {

Perror("get_pt_info");

Exit(-1);

Show_pt_info();

We calculate the starting amount to the section:

Start_seek = (__u64) (pt_t.sect_before) * 512;

Read the clusters that belong to the file:

Num = fat32_read_file(full_path, cluster_num);

If(num< 0) perror("fat32_read_file");

Else printf("Read %d clusters\n", num);

Close(hard);

Return 0;

Information about the partition table is read by the get_pt_info() function:

int get_pt_info(int hard)

Int i = 0;

U64 seek;

We read the partition table from the MBR and check the signature:

Read_main_ptable(hard);

If(check_sign()< 0) {

Printf("Not valid signature!\n");

Return-1;

Looks like the identifier of the extended partition. If this is the case, we calculate the load to the extended partition and read information about logical disks:

for(; i< 4; i++) {

If((pt_t[i].type_part == 0xF) || \

(pt_t[i].type_part == 0x5) | \

(pt_t[i].type_part == 0x0C)) (

Seek = (__u64) pt_t [i].sect_before * 512;

Read_ext_ptable(hard, seek);

Break;

Return 0;

Function for reading the partition table read_main_ptable():

void read_main_ptable(int hard)

If(read(hard, mbr, 512)< 0) {

Perror("read");

Close(hard);

Exit(-1);

Memset((void *)pt_t, 0, (PT_SIZE * 4));

Memcpy ((void *) pt_t, mbr + 0x1BE, (PT_SIZE * 4));

Return;

Signature verification function check_sign():

int check_sign()

U16 sign = 0;

Memcpy((void *)&sign, (void *)(mbr + 0x1FE), 2);

#ifdef DEBUG

Printf("Signature - 0x%X\n", sign);

#endif

If(sign != SIGNATURE) return -1;

Return 0;

Function for reading the extended partition table:

void read_ext_ptable(int hard, __u64 seek)

Int num = 4; // Starting from this position, the array of structures pt_t is filled with information about logical disks

U8 smbr;

Input data:

  • hard- I will attach a descriptor to the file;
  • seek- Displacement to the extended partition per disk space (in bytes).

To retrieve information about logical disks, we organize a cycle:

For(;;num++) (

Read SMBR, which is determined by the seek offset from the disk edge:

Memset((void *)smbr, 0, 512);

Pread64(hard, smbr, 512, seek);

We store two elements of the table pt_t, starting at position num. The first element will be placed on the logical disk, and the other will be placed on the SMBR structure:

Memset((void *)&pt_t, 0, PT_SIZE * 2);

Memcpy((void *)&pt_t, smbr + 0x1BE, PT_SIZE * 2);

We make an amendment to the field “Number of the cob sector” - it is carried out from the cob of the disk:

Pt_t.sect_before += (seek/512);

Since the partition type code is equal to zero, there are no more logical disks:

If(!(pt_t.type_part)) break;

Let's calculate the amount up to the current SMBR:

Seek = ((__u64) (pt_t.sect_before + pt_t.sect_total)) * 512;

Return;

The show_pt_info() function displays information about detected logical drives on the device:

void show_pt_info()

Int i = 0, n;

#ifdef DEBUG

Printf("The number of partitions on the disk is %d\n", PART_NUM);

#endif

For(; i< MAX_PART; i++) {

If(!pt_t[i].type_part) break;

Printf("\nPartition type %d - ", i);

For(n = 0; n< PART_NUM; n++) {

If(pt_t[i].type_part == i386_sys_types[n].part_type) (

Printf("%s\n", i386_sys_types[n].part_name);

Break;

If(n == PART_NUM) printf("unknown type\n");

Printf("Location sign - 0x%X\n", pt_t[i].bootable);

Printf("Sectors in section %d - %d\n", i, pt_t[i].sect_total);

Printf("Sectors before section %d - %d\n\n", i, pt_t[i].sect_before);

Return;

Reading clusters to a file with a FAT32 partition uses the fat32_read_file() function. This function has a lot in common with the fat16_read_file() function, so for detailed comments go to step 6:

int fat32_read_file(__u8 *full_path, int num)

Struct split_name sn;

U8 tmp_name_buff;

Int i = 1, n;

U32 start_cluster, next_cluster;

U8 * tmp_buff;

Preparatory operations – clean the buffer, check the structure and check the first slash:

Memset(tmp_name_buff, 0, SHORT_NAME);

Memset((void *)&sn, 0, sizeof(struct split_name));

If (full_path! = "/") return -1;

Considerably a vanguard sector:

If(read_fbs()< 0) return -1;

Memcpy((void *)§or_size, (void *)fbs.sector_size, 2);

Memcpy((void *)&dir_entries, (void *)fbs.dir_entries, 2);

Memcpy((void *)§ors, (void *)fbs.sectors, 2);

The structure of FSInfo can be read and the signature contained in it can be seen:

If(read_fs_info()< 0) return -1;

Printf("Signature1 - 0x%X\n", fsinfo.signature1);

Printf("Signature2 - 0x%X\n", fsinfo.signature2);

Fat32_size = fbs.fat32_length * 512; // FAT32 size in bytes

Data_start = 512*fbs.reserved+fat32_size*2; // cob of the tribute field

Byte_per_cluster = fbs.cluster_size * 512; // Cluster size in bytes

Root_cluster = fbs.root_cluster; // Cluster number of the root directory

Read FAT32:

If(read_fat32()< 0) return -1;

The memory for directory entries is visible:

Dir_entry = (__u8 *) malloc (byte_per_cluster);

If(!dir_entry) return -1;

Read the root directory:

If(read_directory(root_cluster)< 0) return -1;

We are conducting a selection of the entire file and section of the skin element in the warehouse:

While(1) (

Memset(tmp_name_buff, 0, SHORT_NAME);

Memset((void *)&sn, 0, sizeof(struct split_name));

For(n = 0; n< SHORT_NAME; n++, i++) {

Tmp_name_buff[n] = full_path[i];

If((tmp_name_buff[n] == "/") || (tmp_name_buff[n] == "\0")) (

I++;

Break;

Tmp_name_buff[n] = "\0";

If(split_name(tmp_name_buff, &sn)< 0) {

Printf("not valid name\n");

Return-1;

If(get_dentry(&sn)< 0) {

Printf("No such file!\n");

Return-1;

To extract the starting number of a cluster from a FAT32 file system, it is necessary to enter the older word of the number of the first cluster in the file - the starthi field of the dentry structure:

Start_cluster = (((__u32)dentry.starthi<< 16) | dentry.start);

We check the attribute byte:

If(dentry.attr & 0x10) (// this directory

If(read_directory(start_cluster)< 0) return -1;

Continue;

If(dentry.attr & 0x20) (// a file

Tmp_buff = (__u8 *) malloc (byte_per_cluster);

N = open("clust", O_CREAT | O_RDWR, 0600);

If(n< 0) {

Perror("open");

Return-1;

Printf("file`s first cluster - 0x%X..", start_cluster);

For(i = 0; i< num; i++) {

Memset(tmp_buff, 0, byte_per_cluster);

If(read_cluster(start_cluster, tmp_buff)< 0) return -1;

If(write(n, tmp_buff, byte_per_cluster)< 0) {

Perror("write");

Return-1;

If(next_cluster == EOF_FAT32) (

Free(tmp_buff);

Close(n);

Return ++i;

Start_cluster = next_cluster;

Return i;

The purposes of these three functions are to hold them in place of the system area, then. private sector, FSInfo structure and FAT32 table:

1) the read_fbs() function selects the reading of the reserved sector:

int read_fbs()

If(pread64(hard, (__u8 *)&fbs, sizeof(fbs), start_seek)< 0) return -1;

Return 0;

2) the read_fs_info() function reads the FSInfo structure:

int read_fs_info()

U64 seek = (__u64) fbs.info_sector * 512 + start_seek;

If(pread64(hard, (__u8 *)&fsinfo, sizeof(fsinfo), seek)< 0) return -1;

Return 0;

3) the read_fat32() function reads the FAT32 table:

int read_fat32()

U64 seek = (__u64) fbs.reserved * 512 + start_seek;

Fat32 = (void *) malloc(fat32_size);

If(!fat32) return -1;

If(pread64(hard, (__u8 *)fat32, fat32_size, seek)< 0) return -1;

Return 0;

The read_cluster() function selects the cluster read from the assigned number:

int read_cluster(__u32 cluster_num, __u8 *tmp_buff)

U64 seek = (__u64) (byte_per_cluster) * (cluster_num - 2) + data_start + start_seek;

If(pread64(hard, tmp_buff, byte_per_cluster, seek)< 0) return -1;

Return 0;

Reading directories (including the root directory) is handled by the read_directory() function:

int read_directory(__u32 start_cluster)

Int i = 2;

U32 next_cluster;

Function parameters – starting cluster directory. Read instead of the directory to the global buffer dir_entry:

If(read_cluster(start_cluster, dir_entry)< 0) return -1;

Next_cluster = fat32;

Since the directory occupies one cluster, it appears that there is a larger memory size and continued reading:

For(; ;i++) (

Start_cluster = next_cluster;

Dir_entry = (__u8 *) realloc(dir_entry, i * byte_per_cluster);

If(!dir_entry) return -1;

If(read_cluster(start_cluster, (dir_entry + (i - 1) * byte_per_cluster))< 0) return -1;

Next_cluster = fat32;

If((next_cluster == EOF_FAT32) || (next_cluster == 0xFFFFFF8)) return 0;

Return 0;

The remaining function, as we will look at, looks for an element in the directory that corresponds to the file:

int get_dentry(struct split_name *sn)

Int i = 0;

The dir_entry directory configures the memory area to place an array of entries in the directory in which we are saving the file (or directory). To search, we organize a cycle and find a record located in the global dentry structure:

For(;;i++) (

Memcpy((void *)&dentry, dir_entry + i * sizeof(dentry), sizeof(dentry));

If(!(memcmp(dentry.name, sn->name, sn->name_len)) &&

!(memcmp(dentry.ext, sn->ext, sn->ext_len)))

Break;

If(!dentry.name) return -1;

Return 0;

At this point, reading the file from the FAT32 partition is complete.

The output texts of the module are in the FAT32 directory, file fat32.c.

Features in organizing the saving of file records in directories for FAT and EXT2 file systems

A few words about the importance of organizing the saving of file records in directories for FAT and EXT2 file systems. The structure of the EXT2 file system was reviewed at.

We are well aware of FAT - all the elements in the catalog have a fixed value. When the file is created, the file system driver looks for the first unoccupied position and stores information about the file. If the current directory does not fit in one cluster, another cluster is added to it, etc.

Let's take a look, check it in EXT2.

Let’s say we have a partition with the EXT2 file system, the block size is 4096 bytes. For which section we create a catalog. The size of the directory is equal to the size of the block – 4096 bytes. In the catalogue, the operating system simultaneously creates two records - a stream record and a record of the father's catalogue. An entry in a streaming directory takes 12 bytes, which is equivalent to an entry in Fatherland's ancient catalogue, 4084 bytes. Let's create any file in this catalogue. After this, there will be three entries in the catalog - an entry for the stream directory with 12 bytes, an entry for Father’s directory with 12 bytes, and an entry for the created file with, as you melodiously guessed, 4072 bytes. As soon as the file has been created, I will add it to the Batkiv directory and increase it to 4084 bytes.

Thus, when a file is created, the EXT2 file system driver searches the catalog for the maximum record entry and splits it, making room for a new entry. Well, if the space still doesn’t work, another block is added to the directory, and the directory reaches 8192 bytes.

And finally – a minor correction to the article “Architecture of the EXT2 file system”.

This change involves the function of assigning the inode number to the file name get_i_num(). The old version of this function looked like this:

int get_i_num(char *name)

Int i = 0, rec_len = 0;

Struct ext2_dir_entry_2 dent;

For(; i< 700; i++) {

If(!memcmp(dent.name, name, dent.name_len)) break;

Rec_len + = dent.rec_len;

Return dent.inode;

Correction option:

int get_i_num(char *name)

* Function parameter – file name. The value that turns is the inode number of the file.

Int rec_len = 0;

Struct ext2_dir_entry_2 dent; // This structure determines the format of the root directory entry:

* The global buffer buff contains an array of directory entries. To assign a serial number to a file, you need to know the inode

* This array of records is in this file. For which we organize a cycle:

For(;;) (

/* Copied to the dent structure of the directory entry: */

Memcpy((void *)&dent, (buff + rec_len), sizeof(dent));

* If the file name is greater than zero, it means that we have enumerated all entries in the directory

* The records in our file were not found. So, it’s time to turn around:

If(!dent.name_len) return -1;

/* The search ends with the way of aligning file names. If the names are avoided, we exit from the loop: */

If (! memcmp (dent.name, name, strlen (name))) break;

/* If the names are not the same, we will replace them with the new entry: */

Rec_len + = dent.rec_len;

/* If successful, the inode number of the file is rotated: */

Return dent.inode;

Literature:

  1. V. Kulakov. Programming on the hardware level: a special witness. 2nd view. / - St. Petersburg: Peter, 2003 - 848 p.
  2. A.V.Gordiev, A.Yu.Molchanov. System software / - St. Petersburg: Peter - 2002 r.
  3. Meshkov V. Architecture of the ext2 file system. - Magazine "System Administrator", No. 11 (12), leaf fall 2003. - 26-32 s.

In contact with

Perhaps you have heard more than once about such file systems as FAT32, NTFS and exFAT. But what is the difference between them? Skin type has a moist set of pros and cons. There is no good option for this. In this article we will look at the main features of the three file systems.

Speaking about the Windows operating system, we know for sure that a logical partition is installed in the NTFS format. Many storage devices and other storage devices that are based on a USB interface use the FAT32 type.

One of the formats that can be used for formatting Flash storage devices is exFAT - an successor to the old FAT32 file system.

Thus, we have three main data storage formats that are widely used both for Windows and for various media.

What is a file system?

The file system is a set of rules that determine how documents are stored and retrieved on the device. You can use a hard drive, Flash storage, or an SD card.

For greater understanding, let’s look at the office of a specific company. Fragments of installed documents are stored in a place, for example, in a drawer. And if it is necessary to open them, the file system is restored to the files in an attempt to recover the information.

Korisny statti


Let us accept for a moment that such a system has gone wrong and we immediately notice the great quantity of unknown data, considering that there will be no need for possibility.

It is true that there are a large number of file systems, such as Flash File System, Tape File System and Disk File System, but there is little mention of the main ones. FAT32, NTFSі exFAT.

What is FAT32?

The FAT32 file system is the oldest and most established in the history of computer technology. This route originated from the original 8-bit FAT system in 1977, which functioned in the middle of a standalone disk Microsoft Standalone Disk Basic-80. Vin bu launches specifically for Intel 8080 NCR 7200 in 1977/1978, using the data terminal with 8-inch disks.

After a discussion about the introduction of the system with Microsoft founder Bill Gates, the code was written by the company's first hired security officer, Mark McDonald.

The main tasks of the FAT file system were based on the data of the Microsoft 8080/Z80 operating system based on the MDOS/MIDAS platform, written by Mark MacDonald.

Further, FAT has seen several changes, gradually moving from its original form to FAT12, FAT16 and, finally, FAT32, which are now closely associated with external storage devices.

The main function of FAT32 among its predecessors is the subset of the surrounding area available for saving information. 32-bit The system was released in early 1995 along with the release of Windows 95, and in its updated version allowed the upper limits of file and data storage sizes to be increased to 4 GB and 16 TB.

Therefore, FAT32 is not intended for saving large obligations and installing important programs. Moreover, on hard drives the file system is vikorized NTFS, which allows traders to stop thinking about acquiring information.

In summary, the FAT32 system is ideal for saving data, the amount of which does not exceed 4 GB on any small media. Its popularity is not limited to the computer sphere. It is used in game consoles, high-definition TVs, DVD players, Blu-Ray players and other devices with a USB port. FAT32 is supported by all versions of Windows, Linux and MacOS.

What is NTFS?

In 1993, Microsoft introduced a new file system NTFS(New Technology File System) in parallel with the emergence of the Windows NT 3.1 operating system.

The main feature of the NTFS system is the presence of any boundaries on the size of files that can be stored. If we ever tried to exceed this limit, we would know that we had failed - so much so.

Development began in the mid-1980s during the merger between Microsoft and IBM, which created a new operating system that surpassed the previous ones in graphical productivity.

The union of the two companies did not last long and, without completing the final project, they decided to start a new operation. Over the years, Microsoft and IBM have focused on the development of powerful file systems.

For computer technologies, 1989 was marked by the creation of HPFS from IBM, which was developed for the OS/2 operating system. Dekilkom later, in 1993, Microsoft launched NTFS v1.0 This became the official file system for Windows NT 3.1.

The theoretical size of an NTFS file is 16 EB - 1 KB, which makes it 18446744073709550502 bytes. The development team included Tom Miller, Harry Kimuru, Brian Andrew, and David Goebel.

The latest version of the file system is NTFS v3.1, launches specifically for Microsoft Windows XP. In the future, she did not recognize any special changes, although many different additions had been made before her. For example, it was possible to compress logical partitions, update and symbolic messages of NTFS. In addition, the total capacity of the file system became only 256 MB from a whopping 16 EB - 1 KB in new versions launched with the release of Windows 8.

Speaking about the main features introduced in NTFS v3.1, we can mean the expansion of file formats that are supported, disk quotas, file encryption and the creation of a re-processing point. It is noteworthy that the new versions of NTFS are completely different from the previous ones.

The NTFS file system has an important feature if it is possible to get to its update through any kind of error. You will need to have a specific data structure that will support any changes to the system and will help you reverse the functionality of NTFS.

This file system is supported by all versions of Windows, starting with Windows XP. It's a pity that MacOS doesn't share the same level of insanity as Microsoft. Apple has removed the ability for computer users to read data from NTFS drives; otherwise, they will not be able to write to them. File system support on Linux is limited to just a few versions.

What is exFAT?

ExFAT(Extended FAT) is a new, expanded file system from Microsoft that successfully replaces its predecessor in the field when on the right you get to the great obligations of information.

As you well know, most of today's digital cameras use the exFAT system, which is completely superior to NTFS, but at the same time allows you to save files larger than 4 GB in a FAT32 format.

In this way, when you copy a 6 GB document to a Flash drive using the exFAT file system, you will not encounter negative consequences that can be encountered if you use an earlier version of the system.

The exFAT format is gaining more and more popularity and is popular with high-end SDXC memory cards. The main reason is the small size of the file system and, as previously described, the ability to save documents larger than 4 GB.

We will note the fact that Microsoft retains US Patent 8321439, which allows you to quickly find a file by a specific hash name. These functions of any document can be found out much more quickly.

Please note that for the exFAT file system, all available add-ons for illegal access have not been released. For this product, customers must be licensed under Microsoft.

This action was created so that customers would not try to monetize the Microsoft product, which they consider to be part of the company, because of the stink of the file system output code.

Microsoft remains unchanged in its stubbornness, many developers have been busy creating power modifications of exFAT, one of which has become exfat-fuse. It will provide read and write operations for Linux distributions, including FreeBSD.

The exFAT file system was created in 2006, which has the same information as NTFS, which is lightweight, so it cannot accommodate various add-ons, as a friend.

ExFAT supports reading, writing and compatibility with Mac, Android and Windows operating systems. For Linux you need additional security software.

Upgrading file systems

FAT32:

  • Crazyness: Windows, MacOS, Linux, game consoles and devices with a USB port.
  • Pros: cross-platform intelligence, lightweight file system.
  • Disadvantages: sharing file sizes (available documents up to 4 GB) and partition sizes up to 16 TB.
  • Purpose: famous hoarders. Vikorist is used for formatting Flash storage devices, exFAT is better.

NTFS:

  • Crazyness: Windows, MacOS (only available for reading), Linux (only available for some distributions), Xbox One.
  • Pros: There is a difference in the size of files and sections.
  • Disadvantages: Cross-platform confusion is limited.
  • Purpose: It is well suited for internal hard drives, as it allows you to save important information that other file systems cannot access.

exFAT:

  • Crazyness: Windows XP and newer versions, MacOS 10.6.5 and higher, Linux (including FUSE), Android.
  • Pros: There are some positive effects with FAT32 and NTFS, including the ability to save files larger than 4 GB.
  • Disadvantages: Microsoft shares a vicarious license.
  • Purpose: Allows you to turn on file size sharing for significant users. Much more beautiful than its predecessor FAT32.

If you need to restore a logical partition with an unknown, corrupted or remote file system, Starus Recovery tools will help you.

Tool Starus Partition Recovery, or its analogues, Starus FAT Recovery, Starus NTFS Recovery, are designed for working with legacy file systems - FAT and NTFS. The main software for interaction with the general public. You can explore and try out programs for updating FAT32 and NTFS file systems absolutely free of charge!

This article is dedicated file systems . At the time of installation, Windows prompts you to select a file system for the partition that will be installed, and your PC will have to choose from two options. FAT or else NTFS.

In the majority of cases, koristuvachs are satisfied with the knowledge that NTFS is "more beautiful" and choose this option.

However, sometimes it becomes difficult, and what is more beautiful?

I will try to explain this statistic, What is the file system, what it is, what it is, what it is, and what it is like to be victorious.

The article has simplified some technical features of file systems for a better understanding of the material.

File system- This is a method of organizing data on media. The file system determines where files will be written to the device and gives the operating system access to those files.

Today's file systems provide additional features: the ability to encrypt files, file access delimitation, and additional attributes. The file system is recorded on the hard drive. ().

From the looks of it, the OS, the hard disk, costs a set of clusters.

Cluster– this is a small-sized area for saving data. The minimum cluster size is 512 bytes. Nowadays, a two-level numerical system is used, the size of the clusters is a multiple of two.

Koristuvach can figuratively see a hard drive as a notepad in a closet. One cell on the side is a cluster. The file system is a notepad, and a file is a word.

For hard drives on PCs, there are currently two broad file systems: FAT or else NTFS. Showed up right away FAT (FAT16), then FAT32, and then NTFS.

FAT(FAT16) This is an abbreviation File Allocation Table(in translation File Allocation Table).

The FAT structure was broken up by Bill Gates and Mark McDonald in 1977. It was used as the main file system in DOS and Microsoft Windows operating systems (up to Windows ME).

There are several versions of FAT - FAT12, FAT16, FAT32і exFAT. The stinks are eliminated by the number of bits by entering the cluster number.

FAT12 mainly for floppy disks, FAT16- for small volume disks, and new exFAT important for flash drives. The maximum cluster size supported by FAT is 64Kb. ()

FAT16 first presented in November 1987. Index 16 The name indicates that the cluster number is 16 bits. As a result, the maximum disk partition (volume) that the system can support is 4GB.

Later, with the development of technology and the emergence of disks with a capacity of over 4 GB, a file system appeared FAT32. This is a 32-bit addressing of clusters and appeared immediately from Windows 95 OSR2 in 1996. FAT32 The volume appears to be 128GB. This system can also support long file names. ().

NTFS(Abbreviation NewTechnologyFileSystem - New technology file system) is a standard file system for the Microsoft Windows NT family of operating systems.

Introduced on 27 June 1993 with Windows NT 3.1. NTFS is fragmented on the basis of the HPFS file system (abbreviation HighPerformanceFileSystem - Highly productive File System), which was created jointly by Microsoft and IBM for the OS/2 operating system.

Main features of NTFS: it is possible to separate access to data for different users and groups of users, as well as assign quotas (sharing the maximum amount of disk space that is occupied by other users), using a logging system to improve the file system information.

File system specifications are closed. Set the cluster size to 4Kb. We really don’t recommend creating volumes larger than 2TB. Hard disks have only reached such sizes, perhaps a new file system will be waiting for us in the future. ().

At the hour of installation of the Windows XP OS, the system is prompted to format the disk. FAT or else NTFS. When it comes to respect FAT32.

All file systems are based on the principle: one cluster - one file. Tobto. one cluster saves data in less than one file.

The main consideration for the primary manager between these systems is the cluster size. “It’s been a long time since disks were small, and files were even small,” it was even more noticeable.

Let's look at the example of one volume on a 120GB disk and a 10Kb file.

For FAT32 The cluster size will be 32Kb, and for NTFS - 4Kb.

U FAT32 Such a file will occupy 1 cluster, which will leave you with 32-10 = 22Kb of unoccupied space.

U NTFS Such a file will require 3 clusters, which will leave you with 12-10 = 2Kb of unoccupied space.

Following the analogy with a notepad, a cluster is a cell. And having put a mark on the cage, we logically occupy it all, but in reality we are deprived of a rich place.

In this manner, the transition from FAT32 before NTFS allows you to optimally use your hard drive due to the large number of files in the system.

The 2003 version has a 120GB disk, divided into 40 and 80GB volumes. If I switch from Windows 98 to Windows XP and convert the disk from FAT32 V NTFS I've removed nearly 1GB of saved space on the disk. At that time there was a sutteva “additive”.

To find out what file system is being configured on hard disk volumes, you need to open the authorities window on the tab. "Zagalni" read this data.

Volume- this is synonymous with disk partition, which is why they are called “drive C”, “drive D”, etc. The butt of the readings on the little one is lower:

Currently, disks with a capacity of 320GB and larger are widely available. So I recommend the Vikory system NTFS for optimal storage of disk space.

Also, if you have a desktop computer on your PC, NTFS allows you to configure access to files in such a way that different users cannot read or change the files of other users.

For organizations that work at the local network, system administrators use other NTFS capabilities.

If you need to organize access to files for multiple users on one PC, it will be described in the following articles.

At the time of writing the article, the materials from the sites ru.wikipedia.org

Author of the article: Maxim Telpari
Koristuvach PC with 15 years of experience. A specialist in the support service for the video course “Advanced PC Ownership”, having learned how to assemble a computer, install Windows XP and drivers, update the system, use programs and much more.

Make money on this article!
Register with the affiliate program. Replace the sent message with a course on your affiliate message. Add an article to your website. You can download the version for your friend.

© 2024 androidas.ru - All about Android