What is a File System and How Does it Work?

by Carson
259 views
File system

When you create, modify, delete, or access files or folders, it’s easy to forget what’s going on behind the scenes. That is the work of a file system, and we’ll briefly discuss what it is and how it operates.

What Is a File System

A file system is a large set of instructions and data that tells the computer how to retrieve files and directories (folders). They also contain metadata about the files, such as the file path, the filename, permission information, the date when it’s last modified, where that file exists, and more.

Moreover, some of the metadata doesn’t exist in the file! For example, if you create a blank document, right-click it on File Explorer, and select “Properties”, it shows data about the file where the file occupies zero bytes! That’s because the data is not stored on the file itself; it’s on a file table.

There is information about every single file, even files that take zero bytes
Edited using Canva
Photographed from File Explorer

How Does a File System Keep Track of Files?

When you look at the “Properties” of a file, why is the “Size” and “Size on Disk” different? Disks are split into sectors, which are essentially blocks that can store data. One sector can hold one file at most and usually consists of 512 bytes. For instance, if a file exists whose size is 768 bytes, it won’t take up one-and-a-half sectors. It will occupy two.

However, this is not enough to explain the entire difference between the two variables above. Why is the difference often larger than 512 bytes, or a single sector? Well, file systems merge multiple sectors into clusters to increase efficiency. The number of sectors (and bytes) in every cluster can only be an exponent of 2. That means it is limited to 512 bytes, 1 KB, 2 KB, 4 KB, 8 KB, and so on. With that considered, the difference between the “Size” and the “Size on Disk” is apparent.

Sectors and tracks are tagged on a hard drive, allowing files to be easily found by spinning the disk to a specific location to read the data.

Deleting Files

Do you know that permanently deleting a file doesn’t erase the data? Some software can recover deleted data. Even after a file has been deleted from the Recycle Bin (or similar folders), it will only remove the associated record in the file table, making it inaccessible in a conventional way. That space that holds the files will be listed as available, and the operating system has permission to overwrite it.

Parts of the data can still be recovered with the right software and a little luck. Therefore, if there is sensitive data that you absolutely need to get rid of, you’d better erase the whole drive by overwriting the entire storage device.

Fragmentation

As files are deleted, new files overwrite the sectors that are previously occupied by the deleted files. However, if larger files are written, the sectors will not be enough for the file. Therefore, it will store the rest of the content in other parts of the hard drive. Then, the file table will have to mark the file’s physical address in multiple sectors, which will separate parts of the file. Over time, this process continues until the hard drive becomes full of shards of files.

This is fragmentation, and it can slow down the process of opening a file. It requires your hard drive to read data in different physical locations, taking some time. Defragmentation is a process that brings those files back together so that the hard drive can read them faster, and that is one way to improve your computer performance.

Changing File Systems

If you want to change the file system used on the drive, you’d better copy all important data first. Since the formatting process will delete all data, it is gone for good if you don’t have a backup. After the partition is erased, a new copy of a file system will be installed, and you’re good to go.

Conclusion

When you access, modify, delete or create files and folders, it’s important to know what’s going on behind the scenes. If you want to learn more, visit the websites in the references below.

References and Credits

  1. Reza Lavarian. (2021, February 22). What Is a File System? Types of Computer File Systems and How they Work – Explained with Examples. Retrieved June 20, 2021, from https://www.freecodecamp.org/news/file-systems-architecture-explained/
  2. Chris Hoffman. (2016, September 22). What Is a File System, and Why Are There So Many of Them? Retrieved June 20, 2021, from https://www.howtogeek.com/196051/htg-explains-what-is-a-file-system-and-why-are-there-so-many-of-them/
  3. Tim Fisher. (2020, July 20). What Exactly Is a File System? Retrieved June 20, 2021, from https://www.lifewire.com/what-is-a-file-system-2625880

Related Posts

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.