Complete Guide: An Overview of Linux Filesystems

Complete Guide: An Overview of Linux Filesystems blog banner image

A filesystem (FS) is an organized collection of data and methods used to store, retrieve, and manage information on a storage device. In computing, it is the structure and logic that defines how files are named, stored, organized, and accessed by the operating system and applications. 

This guide aims to provide a comprehensive overview of Linux filesystems, their types, structures, and significance in the Linux operating system in order to help readers understand the foundational concepts of Linux filesystems for better system management and operation. 

The importance of filesystems in operating systems

Filesystems are fundamental to the operation of any computer system. They provide the means by which the operating system organizes and isolates data, ensuring that information is stored efficiently and securely. This isolation allows different processes to run simultaneously without interfering with each other’s data.

For system administrators and Linux users, mastering filesystems is essential. Here’s why:

  • Performance tuning: Understanding filesystems can help in optimizing the performance of a system by selecting the right type for specific needs.
  • Security management: Knowledge of filesystems is crucial in managing permissions and protecting data.
  • System recovery: In cases of system failures, a solid grasp of filesystems can aid in data recovery processes.
  • Efficient storage handling: Administrators can make informed decisions about partitioning, maintaining, and scaling system storage.

Major Linux filesystems and their properties

FS Features Advantages Disadvantages
ext4 Stands for fourth extended filesystem, widely used for robustness with a journaling feature to prevent data corruption after crashes. Mature, high data integrity, good support for large files. Limited by total volume size.
XFS Known for high performance and scalability, particularly with large files and volumes; excels at parallel I/O. Excellent performance with large files, high scalability. More complex to manage; poor performance with small files.
Btrfs Features snapshotting, dynamic inode allocation, and integrated device management; supports transparent compression. Advanced features like error detection, flexible volume management. Younger, less widespread support compared to ext4.
ZFS on Linux Originally designed for Solaris, supports high storage capacities and integrates file system and volume management; includes robust data integrity verification. High data integrity, supports large storage capacities. Requires more memory for optimal performance.
exFAT & ntfs-fuse Supports Windows filesystems under Linux, enabling read and write operations on Windows-formatted partitions; optimized for flash memory and manages NTFS via user-space drivers. Enables seamless handling of Windows files on Linux. Performance can vary; potential for compatibility issues.

Linux filesystem tree overview

Arguably, what stands out the most about the Linux filesystem is that it is structured as a single unified tree, with all your mounted filesystems merely mounted as directories in the tree. It is rooted at the root directory (/) – This is the top-level directory on your system, and all files and directories start from this point; every mounted filesystem integrates into this tree. 

The Filesystem Hierarchy Standard (FHS) standardizes directory layouts across Linux distributions, aiding software compatibility and system backup processes. Key directories include /bin for executable binaries, /etc for configuration files, /home for user directories, and /var for variable data such as data directories for services such as web-, database-, or email servers. Navigating the Linux filesystem tree involves using these standardized structures and commands to manage files efficiently and maintain system integrity.

Interacting with the filesystem

  • Getting help: Most commands provided will have a manual, accessible by running man [command], eg. man cp.
  • Navigation and manipulation: Commands such as cd to change directories, ls to list directory contents, and file operations like touch, cp, mv, and rm manage files directly.
  • Mounting/Unmounting: External storage devices are mounted into the filesystem tree at designated points (eg. The block device /dev/sdb1 (First partition on your second hard drive) is mounted at /media/user/VolumeName), allowing seamless access to files regardless of the storage medium. Transparent mounting of remote/cloud storage permitted via FUSE (Filesystem in UserSpacE).
  • Security / Ownership and Permissions: Each file and directory is assigned permissions that determine access rights for the owner, assigned user groups, and others. System administrators can adjust these permissions using chmod and chown to control file access and maintain system security. Permissions can be granularly selected; read, write, and execute permissions can be separately set per user, usergroup, or other criteria.

Filesystem mounting and management

  • Mounting filesystems in Linux:
      • With the mount command: Mounting a filesystem involves attaching it to a specific directory (mount point) in the existing directory structure. This is typically done using the mount command, specifying the filesystem type and options as needed (though most filesystems are autodetected:
        • mount [-t fstype] [-o options] /path/to/device /path/to/mountpoint
      • With the /etc/fstab (filesystem table) file: Automatically mount a filesystem by adding a corresponding line to the /etc/fstab file as per the example. Automounting will then take place on boot, external drive insertion, or by running the mount -a command. While exploring this method in-depth is outside the scope of this article, you can find more information here or with the man fstab command. (The dump and PassNo fields have to do with disk error checking; research before modifying.)
        • sudo nano /etc/fstab
          then add a line to the bottom of the file:
        • #<device> <mountpoint> <FS type> <mount opts> <dump><PassNo>
          /dev/sdb1 /media/user ext4 defaults 0 2
  • Unmounting filesystems: To unmount a filesystem, the umount /path/to/mountpoint command is used. It detaches the filesystem from its mount point, ensuring that all data is written to disk and preventing data loss.
  • Examining mounted filesystems:
    • df: This command displays the amount of disk space used and available on all currently mounted filesystems.
    • mount: Used without arguments, this command displays all mounted filesystems, showing where and how each is mounted.

Filesystem operations and commands

Common operations and commands

  • Creating files: touch filename creates a new empty file called filename.
  • Deleting files: rm filename removes files.
  • Copying and moving: cp and mv allow files to be copied or moved between directories.
    • cp sourcefile [/path/to/]filecopy # Copy sourcefile to filecopy.
    • cp -vR sourcedir [/path/to/]targetdir # Recursively copy directory sourcedir and its contents to targetdir.
  • Directory management: mkdir and rmdir are used to create and remove directories.

Permissions and ownership administration

  • chmod: Changes file or directory permissions, eg.:
    • chmod 0644 filename # set permissions numerically
    • chmod +w filename* # make target glob writable
  • chown: Changes the ownership of a file or directory to a specified user and/or group, eg.:
    • chown username filename # username now owns filename 
    • chown -R username[:groupname] directory # recursively changes ownership of a directory plus its contents to username (and optionally groupname).

Navigating the future with Linux filesystems

This guide has covered the essential aspects of Linux filesystems, from types and structures to management and operations. Understanding these components is vital for effective and secure system administration to Linux administrators and users alike, as deep knowledge of filesystems enhances system management capabilities and supports more robust and secure computing environments. Continued learning and hands-on practice with Linux filesystems are encouraged to master the intricacies of system administration and optimize overall system performance.

Next Steps

Building an efficient and effective IT team requires a centralized solution that acts as your core service deliver tool. NinjaOne enables IT teams to monitor, manage, secure, and support all their devices, wherever they are, without the need for complex on-premises infrastructure.

Learn more about Ninja Endpoint Management, check out a live tour, or start your free trial of the NinjaOne platform.

You might also like

Ready to become an IT Ninja?

Learn how NinjaOne can help you simplify IT operations.

Watch Demo×
×

See NinjaOne in action!

By submitting this form, I accept NinjaOne's privacy policy.

Start your 14-day trial

No credit card required, full access to all features

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).