In this lesson, you will learn how to seamlessly integrate external storage and network resources into your existing directory tree while respecting the Filesystem Hierarchy Standard (FHS).
The Concept of Mounting
In Linux, the entire system is represented as a single, unified tree starting at the root directory (/). Unlike other operating systems that assign drive letters (like C: or D:), Linux treats every storage device as just another "leaf" or "branch" on that single tree. To make a new disk or a network folder accessible, we use a process called mounting.
When you mount a device, you are essentially telling the kernel: "Take this external storage and make its contents available at this specific, empty directory path." That directory is called the mount point.
Maintaining the Hierarchical Layout
To keep your system organized, we avoid scattering mounted drives randomly. Following the FHS, we typically use specific locations for these additions:
/mnt: Historically used for temporarily mounted filesystems (like a USB drive or a CD-ROM)./media: The modern standard for removable media (like external hard drives or flash sticks) that are automatically detected by the system./srv: Used for data served by the system, such as network shares or web server content.
A Practical Example
Imagine you have an external drive you want to use for backups. You don't just dump files into a random folder; you attach it to a designated spot.
# First, create a directory to act as the mount point
mkdir /mnt/backup_drive
# Mount the device (e.g., /dev/sdb1) to that location
mount /dev/sdb1 /mnt/backup_drive
Once this command runs, any file you place inside /mnt/backup_drive is actually being written to the physical storage of that external device. Even though the files exist on a separate piece of hardware, they appear to the user as part of the standard hierarchical structure. This abstraction allows applications to interact with data using standard paths, regardless of whether that data lives on a local disk, a partition, or a remote server.
Key Takeaway: Mounting transforms external storage into a seamless branch of your existing filesystem tree, allowing you to manage disparate devices through a unified directory structure.