为什么rhel7会有那么多tmpfs挂接到系统上?
Why are there many tmpfs filesystems mounted on the server?
环境
- Red Hat Enterprise Linux 7
问题
- Why are there many tmpfs on the system which are not in /etc/fstab file?
- What is the purpose of having these tmpfs mounted?
Filesystem Size Used Avail Use% Mounted on
tmpfs 187G 0 187G 0% /dev/shm
tmpfs 187G 41M 187G 1% /run
tmpfs 187G 0 187G 0% /sys/fs/cgroup
tmpfs 38G 0 38G 0% /run/user/1710
tmpfs 38G 0 38G 0% /run/user/900
tmpfs 38G 0 38G 0% /run/user/1708
tmpfs 38G 0 38G 0% /run/user/0
根源
The Linux kernel provides a number of different ways for userspace to communicate with it. For many facilities there are system calls, others are hidden behind netlink interfaces, and even others are exposed via virtual file systems such as /proc or /sys.
These file systems are programming interfaces, they are not actually backed by real, persistent storage. They simply use the file system interface of the kernel as interface to various unrelated mechanisms.
-
/dev/shmis a filesystem that userspace uses for its own API purposes, to store shared memory segments, shared temporary files or sockets. For more details refer to article How to work with /dev/shm in Red Hat Enterprise Linux 7. -
/runis a filesystem which is used by applications the same way/var/runwas used in previous versions of RHEL. Now/var/runis a symlink to/runfilesystem. Previously early boot programs used to place runtime data in/devunder numerous hidden dot directories. The reason they used directories in/devwas because it was known to be available from very early time during machine boot process. Because/var/runwas available very late during boot, as/varmight reside on a separate file system, directory/runwas implemented. -
/run/user/$UIDis a filesystem used by pam_systemd to store files used by running processes for that user. In previous releases these files were typically stored in/tmpas it was the only location specified by the FHS which is local, and writeable by all users. However using/tmpcan causes issues because it is writeable by anyone and thus access control was challenging. Using/run/user/$UIDfixes the issue because it is only accessible by the target user. -
/sys/fs/cgroupsis an interface through which Control Groups can be accessed. For more details refer to cgroups kernel documentation.
诊断步骤
Multiple tmpfs not present in /etc/fstab are seen in df and mount output.
# df
Filesystem Size Used Avail Use% Mounted on
tmpfs 187G 0 187G 0% /dev/shm
tmpfs 187G 41M 187G 1% /run
tmpfs 187G 0 187G 0% /sys/fs/cgroup
tmpfs 38G 0 38G 0% /run/user/1710
tmpfs 38G 0 38G 0% /run/user/900
tmpfs 38G 0 38G 0% /run/user/1708
tmpfs 38G 0 38G 0% /run/user/0
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
https://access.redhat.com/solutions/2435631
浙公网安备 33010602011771号