Computer scienceFundamentalsEssentialsOperating systemsFiles and file systems

Common file systems (FAT32, NTFS, EXT4)

6 minutes read

File systems play a crucial role in managing data storage, organization, and access on various storage devices, like HDD, SSD, and flash drives. They provide a structure that allows the operating system and applications to interact with the storage content in an efficient manner. Different file systems offer various features, performance levels, and compatibility, catering to specific needs and preferences. Three commonly used file systems are FAT32, NTFS, and EXT4. Let's explore each of these in more detail.

FAT32

FAT32, one of the oldest file systems, offers wide compatibility across various operating systems and devices. In FAT32, the system divides and stores files between data clusters, which you access when interacting with a file. A File Allocation Table (FAT) stores information about data clusters on the disk and indicates whether a specific cluster is allocated for a file or directory.

FAT structure

In FAT32, files are divided into multiple data clusters. For each file, FAT32 creates directory entries that contain essential information, such as the first cluster of the file. Then, FAT32 accesses each data cluster in sequence using the information about the next cluster stored in the current one. This process continues until the End Of File (EOF) is reached. For instance, let's consider a picture file stored in clusters 6, 7, and 9. FAT32 begins with cluster 6 and obtains the information that the next cluster is 7. It then proceeds to the next cluster based on this information until it ultimately reaches the EOF at cluster 9.

NTFS

The New Technology File System (NTFS) is a modern file system developed by Microsoft as the default file system for its Windows operating systems. NTFS is designed to provide advanced features, enhanced security, and improved performance compared to its predecessor, the FAT file system.

Similar to other file systems, NTFS divides the storage space into clusters, which are the smallest units used for data allocation. However, NTFS clusters can be larger than those in FAT file systems, allowing for more efficient use of space on larger volumes.

The main component of NTFS is a Master File Table (MFT). It acts like an index that keeps track of all files and directories on the storage device. Each entry in the MFT represents a file or directory and includes metadata like file attributes, permissions, timestamps, and pointers to the data's location on the disk.

MFT structure

NTFS supports the concept of data streams, which allows a single file to have multiple streams of data associated with it. This is used for features like file compression, encryption, and alternate data streams, which can store additional information beyond the main file content.

EXT4

EXT4 (Fourth Extended File System) is a widely used file system in the Linux ecosystem and serves as the successor to the EXT3 file system. EXT4 divides the file system into block groups to organize data efficiently. Each block group contains a subset of inodes, data blocks, and other structures. Grouping these elements together helps improve performance and reduces fragmentation.

EXT4 structure

Here are the main components of block groups:

  1. Superblock: The superblock is a critical structure that contains metadata about the entire file system, including the total number of blocks, free blocks, inode count, and other parameters. It's like the control center that helps manage the entire file system.
  2. Inodes: Inodes (index nodes) are data structures that represent files and directories within the EXT4 file system. Each inode contains information about a specific file, such as its permissions, timestamps, ownership, file size, and pointers to data blocks. To define whether the inode is free or occupied, the block group has an inode bitmap.
  3. Inode Table: The inode table is an array of inodes, and it's a fundamental component of the EXT4 structure. The size of the inode table determines how many files and directories can be stored in the file system.
  4. Data Blocks: EXT4 divides the storage space into blocks, which are fixed-sized units used to store file data. Each block can hold a certain amount of data, and these blocks are grouped together into block groups. To define whether the block is free or occupied, block groups have a block bitmap.

Key features of file systems

File Systems have a few key features that you should know. Here are the basics:

FAT32 NTFS EXT4
Max File Size 4GB 256TB for a cluster 64KB size 16 TiB (≈ 17,5 TB) for 4 or 64 KiB block size
Journaling X X
OS Windows, Linux, macOS Windows Linux

FAT32 is the simplest file system of the three described here. It has no journaling, meaning that it is more vulnerable to data corruption in case of sudden system crashes or power failures. It also has a file size limited only to a 4 GB. But, it is supported by virtually all major operating systems, including Windows, macOS, and Linux. This compatibility makes it a popular choice for cross-platform data exchange. Nevertheless, NTFS and EXT4 are far more complex with some nuances to them.

NTFS is the default file system for Windows. It includes journaling which keeps it safe from data corruption. It is also more secure because each file record includes a security descriptor that specifies the permissions and access rights for different users and groups. This enables administrators to control who can access, modify, or delete files and directories.

On the other hand, EXT4 is a default for Linux. Same as NTFS, it includes journaling which makes it more reliable. EXT4 employs delayed allocation and extents, leading to improved performance and reduced fragmentation, and supports online defragmentation. It also includes backward compatibility with EXT3, the previous iteration of this file system.

Conclusion

In conclusion, the choice of a file system depends on various factors, including the intended usage, operating system compatibility, and desired features. FAT32 offers broad compatibility, NTFS provides advanced features and security for Windows users, while EXT4 excels in the Linux environment with its performance enhancements and scalability. Understanding the strengths and weaknesses of each file system can help users make informed decisions based on their specific requirements.

12 learners liked this piece of theory. 4 didn't like it. What about you?
Report a typo