Formatting a flash drive or system drive is a common task for a computer user. In modern operating systems, the process is greatly simplified, so even a beginner can handle it. The system independently determines which settings are suitable for a particular device and which file system to choose when formatting. So, Windows formats system drives in NTFS, and turns flash drives into FAT32. Why it happens? What is the difference between these file systems and, in general, why does a disk need a “format”?
In simple terms, a computer storage device is like a library that stores thousands of books. The library can be arranged in the form of a small shelf or multi-storey shelf with a staircase, as well as in the form of clusters – huge rooms with dozens of cabinets and hundreds of shelves. To find a book of interest on such a scale, you need to navigate by conventional identification marks, letters or numbers.
For example, we visited the library in search of the work “The Mysterious Island”. At the request of the reader, the librarian turns to the catalog, looks for a department that stores books with titles starting with the letter “T”, then finds a cabinet, a shelf and a place where the edition of interest to the reader is stored. Using such a system, a librarian will find a book in a matter of seconds; it will take much longer for him to reach and carry it to the reader across the hall. The file system in the drive works in a similar way.
Now imagine that all the cabinets and shelves have been taken out of the library, and the books are now lying on tables, chairs, the floor and window sills. The work of Jules Verne will be almost impossible to find among thousands of printed copies: it can be found anywhere, since the books are scattered in an unknown order. At the same time, despite the disorder, the library still fulfills its main task – it stores books. But there is little practical benefit from this: the structure and cataloging are broken in the storage system. The same happens if the drive is devoid of any file system
So, the file system of a computer storage is a way of organizing and storing files on hard drives, flash drives, or even in the cloud. And, if the disk is an array of clusters, then the file system is an instruction for filling these clusters with information.
For example, writing a photo to a regular hard drive, the computer splits the file into parts. Each piece of the file corresponds to a cell on the surface of the disk’s magnetic plate. Moreover, if any program accesses the required file, then neither it nor the disk will know what kind of file it is, where it is located, what it is called, how much it weighs and what cells it occupies in the drive. The only thing that the program knows is the name of the file, its size and other attributes, which it passes to the file system as a symbol for finding this file in the cells.
To understand who is responsible for what and who is, consider the structure in books and libraries. So, in the “user-file” chain there are several actors, without whom the system cannot work:
A drive is a library (like a building or organization).
A user is a reader who has come to the library for a work by Jules Verne.
A file is a book with an understandable name (attribute) or other conventional identifying mark, for example, the “Mysterious Island” mentioned above.
A file system driver is a librarian who acts as an intermediary or conduit between the reader and the book. Or between a user (computer, operating system) and a file (cells with information in memory chips or on magnetic plates).
File system – the order in which the books are arranged in the library, as well as the directory with which the specialist finds the books. There are different systems: books can be arranged by height, cover color, genre, year of issue or title in alphabetical order. On disk, the file system is responsible for organizing files.
The disk system is also a library. Instead of large rooms, compact drive cases are used here, and memory chips in solid-state drives or magnetic plates of classic hard drives act as shelves with books . The cataloging system of a library is the file system of a computer. Like the way books are sorted in a library, computer file systems can be divided into several types. The most common Windows computers are NTFS and FAT32.In stores: in 205 stores
NTFS – New Technology File System
We figured out what a file system is and why computer disks need it. Based on these examples, you can easily understand how different file systems work and how they differ. For example, NTFS.
NTFS is Microsoft’s proprietary file system, which developers began to implement into the Windows operating system, starting with version NT 3.1. Despite the tales of the unreliability and low fault tolerance of this system, NTFS is considered the best and most successful solution for running current Windows operating systems. Of course, like any other system, NTFS is not without its drawbacks – it is too complex a FS device, especially by modern standards. After all, it is known that the more complex the device, the more vulnerabilities it contains.
Structure and fragmentation
The NTFS file system divides the storage space into clusters – blocks ranging in size from 512 bytes to 64 KB. By default, Windows divides blocks of 4KB each.
The way of organizing file space on a disk with NTFS implies the presence of a special section in which the FS stores service data about its work. Namely, it maintains a certain directory in which various data about files and partitions are recorded. This is the MFT (Master File Table) section – free space with a metafile, for which the system allocates 12% of the total volume.
The MFT is a dynamic partition – as information accumulates on the disk, it can shrink to free up space for user files. However, with the first free gigabyte on the disk, the MFT partition will again take its “rightful” space, while the new part of the metafile may become fragmented and be no longer at the beginning of the disk, but at the end or in the middle. Hence, there is the common problem of file system fragmentation where portions of directories are scattered all over the disk. Then, in order to find any file, the disk frantically searches for them all over the surface, hence the decrease in the access speed and overall performance of the computer. Fragmentation is not the strongest point of NTFS.
Files and directories
The organization of data in this FS has a binary tree structure: each element in the system is processed not hierarchically, but through binary queries. For example, to find a file named “K” among thousands of other files, the system divides the directory in two and starts searching in the middle. For example, will it find out in which part to search for a given file, if a file with the name “T” is taken as the middle of the directory? In this case, the system will answer – search among those files that go to the file named “T”. That is, having a directory sorted alphabetically, the system understands that the file with the required name is in one of two parts, and the time to search for a file is halved – this improves the speed of working with small single files.
All files on this system exist as streams. In fact, in order to turn blocks with data into a single file, this FS only needs a file with metadata. This is a kind of instruction for assembling files from pieces of data that are stored in cells across the entire surface of the drive. Due to its flexible file structure, NTFS objects can take on many additional properties. For example, contain up to 65535 different Unicode characters in the name. In this case, the maximum length of the file name reaches 255 characters.
Modern operating systems are based on journaled file systems. This is necessary so that in the event of a system failure and emergency shutdown (unplug the PC power plug), the computer’s file system can be restored to its last working state without losing files.
In a journaled file system, data is handled according to the principle of transactions – an action is performed completely or not at all. For example, when writing a system file to a disk, the computer makes notes in the metafile in the MTF section and keeps a mini-log of the copying process until the file is completely written to the required disk partition. If the device reboots during recording, then the next time it is turned on, the system will refer to the log, learn about committed and uncommitted transactions, and will leave only those marked as completed. The rest of the transactions will be deleted, and the files will be deleted or returned to their place.
As a rule, such a system works most efficiently only with system files, while user data can be damaged or disappear in case of a failure. Logging can be verified by using restore checkpoints – the computer periodically creates snapshots of the system state, from which it can later recover to these states.
Encryption is used to protect data on your computer . It is not just about protecting your computer with a password, but also distributing rights to access files, which is quite easy to open, hack and simply bypass using publicly available instructions and software.