24/7 support, every day of the week 02192039 info@mizbandade.com
لینوکس

A Guide to the Linux File System

آموزش فایل سیستم لینوکس

The Linux file system

The Linux file system is a structured collection of files on a disk drive or partition on your server. Put simply, it’s an internal layer of the Linux operating system used to manage and store data, helping keep files organized on the disk. With the Linux file system you can manage a file’s name, creation date, size and much other information about it.

What the Linux file system does

The Linux file system uses a tree structure that keeps every file stored on the disk organized. The top-level directory is called root, and every other directory in Linux can be reached from the root directory (/).

File system block size

The block size of a Linux file system is the amount of storage the file system uses at a time when reading or writing data. For example, if the block size is set to 4,096 bytes, even a tiny file takes up 4 KB on disk. If you work with lots of very small files, a 4,096-byte block size wastes a lot of space, so you should choose a smaller block size.

Versions of ext (Extended File System)

  • Minix file system: before ext, Linux used the Minix file system from Minix, a small Unix-like operating system written by Andrew Tanenbaum. Minix wasn’t free and open, and the earliest versions of Linux used its file system.
  • ext: an old file system introduced in 1992 by Rémy Card to overcome the limits of Minix. It could manage up to 2 GB of disk space.
  • ext2: a year later, Rémy Card released ext2. Maximum file sizes grew from 16 GB to 2 TB, and it supports volumes from 2 TiB to 32 TiB. However, it had no protection against corruption: a power cut before data was fully written to disk could damage it.
  • ext3: released in 2001 with journaling. Files could range from 16 GiB to 2 TiB, and volumes from 4 TiB to 32 TiB. Journaling makes it much more fault-tolerant: after a power cut or crash, the system can return to a consistent state.
  • ext4: today the default file system on many Linux distributions. It’s faster than its predecessors, and with 4K blocks it supports files up to 16 TiB and volumes up to 1 EiB (exbibyte).

The Linux directory hierarchy

As explained above, Linux organizes files in a tree that starts at the root directory, / (as shown below).

The Linux file system hierarchy
The Linux directory tree, starting at the root directory (/).

A note on journaling

Journaling file systems add a new level of safety to Linux. Instead of writing data straight to the storage device and then updating the inode table, they first write the changes to a temporary journal. Once the data has been written successfully to the device and the inode table, the journal entry is removed. Every hard disk a Linux server uses must be formatted with at least one of the available file systems.

Thanks for reading this guide to the Linux file system. Follow Mizbandade for more.

Leave a comment

Your email address will not be published. Required fields are marked *