At the most general level, most people know what a file system is: A storage utility that stores the data of a server or computer. We know that all our of files, directories and services have to live somewhere, but where do they live; or, perhaps, the real question is how?We know that computers read only the 1s and 0s of its data and that this data must be stored in a way that a computer can understand. This means that file systems are organized bodies of data — for the system, the organization exists through inodes; for users, this is the hierarchy of directories and files from which users can work.
Inodes are a data structure, or a way for computers to efficiently organize data. An inode represents a file system object, and stores the attributes and disk block locations of data. This includes the metadata for an object, as well as the permissions and ownership of that object.Each inode has an individual number. Numbers cannot repeat or be reused in the system, and even when moving an object within the system, the number cannot change. It can, however, be viewed with the
ls -i command, the
-i signifying that the system should output the inode number to each file.
The File System Hierarchical Structure
File System Types
Common file system types for Linux systems include:
- ext2 — The second “extended file system” (the first, ext, is no longer in use). Data is stored in files, with a maximum file size of 2TiB and maximum volume size of 4TiB. File names can be up to 255 bytes.
- ext3 — The third extended file system, an update of ext2. This system uses journaling, and like ext2 supports a maximum file size of 2 TiB and a 255-byte file name limit. However, the maximum volume size is 32 TiB.
- ext4 — The fourth extended file system. As with ext3, it uses journaling and has a 255-byte file name limit. Supports up to 16 TiB file size, with a 1 EiB volume size limit (although 16 TiB is recommended).
- Reiser — Reiser file systems are similar to ext3, but uses a different internal structure to the above systems. Reiser allows for journaling and uses checksums to verify journal files. The maximum volume size is 16 TiB, with a maximum file size of 1EiB. On Linux, the file name is limited to 255 bytes. A newer version of Reiser, called Reiser4 exists, but is currently not incorporated into mainline Linux systems.
Many of the file systems above use something called journaling. Journaling allows for a more reliable file system since non-journaled systems risk corruption during power outages or any issues that can arise which interrupt a save.Journaling systems write changes to logs, which exist in a dedicated area of the system. Then, after the save occurs the system then checks the logs and writes any changes to the main file system; this entails that, while corruption can still happen, it is less likely, and your systems are always consistent.Journaling can occur two ways, data-mode journaling, and ordered-mode journaling. Deciding between the two is a question of data integrity versus speed. Data-mode journaling, which logs both data and metadata, provides the greatest protection against data loss but takes longer and uses more resources than the alternative, ordered-mode journaling, which logs only metadata.
A final concept in file systems is partitioning. Partitioning is a way of taking the larger file system and “sectioning” it off into different data groups; this allows for additional data security, and should data in one partition be corrupted by errors the chance for those errors to affect other partitions is limited.