为什么rhel7会有那么多tmpfs挂接到系统上?

Why are there many tmpfs filesystems mounted on the server?

 SOLUTION 已验证 - 已更新 2018年十月8日20:34 - 

环境

  • 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/shm is 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.

  • /run is a filesystem which is used by applications the same way /var/run was used in previous versions of RHEL. Now /var/run is a symlink to /run filesystem. Previously early boot programs used to place runtime data in /dev under numerous hidden dot directories. The reason they used directories in /dev was because it was known to be available from very early time during machine boot process. Because /var/runwas available very late during boot, as /var might reside on a separate file system, directory /run was implemented.

  • /run/user/$UID is 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 /tmp as 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/$UID fixes the issue because it is only accessible by the target user.

  • /sys/fs/cgroups is 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

posted on 2019-05-21 10:35  梓沂  阅读(386)  评论(0)    收藏  举报