Linux下df命令为何不显示sysfs与procfs文件系统?
df -Th output? Question:
When I run the df -Th command, I only get the following output:
$ df -Th Filesystem Type Size Used Avail Use% Mounted on tmpfs tmpfs 987M 2.1M 984M 1% /run /dev/sda3 ext4 59G 34G 23G 60% / tmpfs tmpfs 4.9G 0 4.9G 0% /dev/shm tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock /dev/sda1 vfat 197M 29M 169M 15% /boot/efi tmpfs tmpfs 987M 4.7M 982M 1% /run/user/1000
Why aren't sysfs and procfs showing up? I thought the df command would display all filesystems on the computer.
Answer:
Great question! The reason you don't see sysfs and procfs in your default df -Th output is because df intentionally filters out certain virtual filesystems by default. Let's break this down:
Default
dfbehavior:dfis built to focus on filesystems that use actual persistent or memory-backed storage (like your ext4 root partition, vfat EFI partition, or tmpfs mounts). Sysfs and procfs are virtual filesystems—they don't store data on disk at all. Instead, they act as live interfaces to kernel data, exposing system and hardware information in real time. Since they have no meaningful "disk usage" metrics (their size/used values would be 0 or irrelevant),dfexcludes them by default to avoid cluttering the output with non-storage-related filesystems.How to view all filesystems: If you want to see every single mounted filesystem—including sysfs, procfs, and other virtual ones like cgroup2 or devpts—use the
-a(short for--all) flag. Run this command:df -aThYou'll now see all mounted filesystems, including the virtual ones you were missing.
Why tmpfs shows up: You might notice tmpfs entries in your original output even without
-a—that's because tmpfs uses system RAM (and swap if enabled) to store temporary data. Unlike sysfs/procfs, tmpfs has measurable size and usage values, sodfincludes it by default as it behaves like a traditional storage filesystem (just in memory).
内容的提问来源于stack exchange,提问作者Autechre

