Sub topic 1
Filesystems and Mount Points: What You Are Actually Measuring
Prerequisites
You should be comfortable using a Linux shell over SSH, reading files and directories, using sudo, and interpreting basic command output. You should also know that a filesystem is managed by the kernel and stores files, directories, and their metadata.
The filesystem boundary
A filesystem is a structure that organizes data on a storage device or a logical storage volume. It records where file contents are stored, which permissions apply, and which directories contain each file. Common Linux filesystem types include ext4, XFS, and Btrfs.
Linux presents filesystems as one directory tree. The root filesystem is mounted at /. Other filesystems are attached to directories called mount points. For example, a server might mount a separate filesystem at /var, /home, or /data.
The mount point is the directory where you enter that filesystem. After /data is mounted, /data/reports belongs to the filesystem mounted at /data, not automatically to the filesystem mounted at /.
findmnt -t ext4,xfs,btrfsThis command lists mounted filesystems of the selected types. Its output normally includes the source device or volume, filesystem type, mount options, and mount point.
A directory does not tell you which filesystem contains it. The mount table does. This distinction matters when investigating disk usage. A command that starts at / can cross into every mounted filesystem unless you explicitly prevent it.
What a usage report measures
A disk report can measure a whole filesystem or the contents visible below a directory.
| Question | Typical tool | Measurement boundary |
|---|---|---|
| How full is the filesystem mounted at `/var`? | `df` | The complete filesystem |
| Which directories under `/var` use space? | `du` | Files reached below `/var` |
| What files are on the root filesystem? | `find -xdev` | Files without crossing mounts |
df asks the filesystem how many storage blocks are allocated and available. It does not begin by adding the sizes of files in a directory. Therefore, df is the right first command for answering, “How full is this mounted filesystem?”
df -hTThe -h option uses readable units such as GiB. The -T option shows the filesystem type. Each row represents a mounted filesystem, although virtual filesystems such as tmpfs may also appear.
The same path can lead into a different filesystem. For example, df -hT /var/log reports the filesystem containing /var/log. If /var has its own mount, the result describes /var, not /.
df -hT / /var /dataAvoiding a misleading total
Suppose /data is a separate filesystem. A scan of / that includes /data may make the root filesystem appear to contain data that is actually stored elsewhere. When comparing a directory scan with df, keep the boundaries consistent.
sudo du -xsh /
sudo du -xsh /varHere, du -x stays on the filesystem where its starting directory is located. This makes a root scan comparable with the root filesystem’s df result.
Exercise
Exercise
A server reports that / is 90% full, but /data contains 500 GB of files and is a separate mount. Should those files be counted as root-filesystem usage?
Show answer
No. The files belong to the filesystem mounted at /data. Use df -hT / and df -hT /data separately, and use du -x when scanning either filesystem.