Nepedia
Back to Discover
Advanced Reader
💻

File system

technology Maturity 11-13 Next article →

A file system, often abbreviated as FS, is a fundamental component of modern computing. It acts as the governing structure for file organization and access. Within a computer, the file system is a capability of the operating system. It services the various applications running on that same machine. Beyond a single computer, it can also function as a protocol. This allows for file access between different computers on a network. Essentially, it provides a data storage service. This service allows multiple applications to share mass storage resources effectively.

Without a file system, computing would be chaotic and unreliable. Applications might attempt to access storage in incompatible ways. This lack of coordination can lead to resource contention. It can also result in data corruption or total data loss. To prevent this, file systems use a layered architecture. The top layer is the logical file system. This layer provides high-level access through an application programming interface, or API. It handles operations like opening, closing, reading, and writing files. It also manages security, protection, and per-process file descriptors.

Dir command in Windows Command Prompt
Dir command in Windows Command Prompt

Below the logical layer sits the physical file system layer. This layer provides low-level access to the actual storage device, such as a disk. It is responsible for reading and writing data blocks. It also handles buffering and memory management. This layer controls exactly where data blocks are placed on the storage medium. It uses device drivers or channel I/O to communicate with the hardware. In some setups, an optional virtual file system layer exists. This layer can support multiple concurrent instances of different physical file systems.

File system fragmentation
File system fragmentation

File systems organize data using specific attributes like names and directories. A file name identifies a specific file to an application or user. Generally, these names must be unique within a single directory. While many systems restrict name length, most modern ones support the Unicode character set. Directories, also known as folders, allow users to segregate files into groups. Some systems use a flat structure, while others allow for complex hierarchies. In a hierarchy, a directory can contain other directories, known as subdirectories. The Multics operating system was the first to support these arbitrary hierarchies.

File system fragmentation
File system fragmentation

Beyond the file content itself, the system manages metadata. Metadata is "data about data" and is stored separately from the file content. This information includes the file name, size, and the date it was last modified. It also tracks the owner and specific access permissions. Metadata can include whether a file is read-only or executable. Some systems, like NTFS or HFS+, even support extended file attributes. These can include user-defined details like an author's name. Some advanced systems even allow for multiple data collections, called streams or forks, under one name.

100 000-files 5-bytes each -- 400 megs of slack space
100 000-files 5-bytes each -- 400 megs of slack space

Efficiently managing storage space is a constant challenge for the file system. It must track which areas of a device are occupied and which are free. When a file is deleted, the system simply marks that space as available. However, storage is often allocated in granular units called clusters or blocks. If a file does not perfectly fill these units, it creates unused "slack space." For example, using 4,096-byte clusters for 100,000 tiny five-byte files can waste over 400 megabytes.

100 000-files 5-bytes each -- 400 megs of slack space
100 000-files 5-bytes each -- 400 megs of slack space

Additionally, files can become fragmented. This occurs when a file is stored in non-contiguous blocks rather than one continuous piece. While fragmentation can slow down hard disk drives, it does not affect solid-state drives.

File system fragmentation
File system fragmentation

Finally, file systems are vital for data integrity and security. They ensure data remains consistent even during crashes or power failures. The system may use recovery methods to handle unwritten data after a reboot. For security, file systems often implement access control. This prevents unauthorized users from reading or modifying sensitive files. This is achieved through passwords, permission bits, or access control lists. Some systems even include built-in encryption methods. Administrators can also set storage quotas to limit how much space a specific user can consume.

Btrfs qgroup screenshot
Btrfs qgroup screenshot
662 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (4)
File:100 000-files 5-bytes each -- 400 megs of slack space.png
100 000-files 5-bytes each -- 400 megs of...
File:File system fragmentation.svg
File system fragmentation.svg
File:Btrfs qgroup screenshot.png
Btrfs qgroup screenshot.png
File:Dir command in Windows Command Prompt.png
Dir command in Windows Command Prompt.png
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.