Question: Why CentOS 7 / RHEL 7 have many tmpfs (6 tmpfs filesystem), are these tmpfs mandatory for OS? What are the mount /run/user/1000, /run/user/0, /run/user/45, /sys/fs/cgroup for?
If you run df -hP in RHEL 7 system you would find many tmpfs file systems mounted.
# df -hP Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_os-lv_root 296G 33G 248G 12% / devtmpfs 126G 0 126G 0% /dev tmpfs 126G 631M 126G 1% /dev/shm tmpfs 126G 1.3G 125G 2% /run tmpfs 126G 0 126G 0% /sys/fs/cgroup /dev/sda1 976M 112M 797M 13% /boot tmpfs 26G 0 26G 0% /run/user/0 tmpfs 26G 0 26G 0% /run/user/5006 tmpfs 9.5G 68K 9.5G 1% /run/user/1000
tmpfs is a temporary filesystem that resides in memory and/or your swap partition(s), depending on how much you fill it up. Mounting directories as tmpfs can be an effective way of speeding up accesses to their files, or to ensure that their contents are automatically cleared upon reboot.
/dev contains device files which are created and removed automatically by the udev daemon, as hardware is added or removed etc. (devtmps is just a tmpfs that was created specially by the kernel early in the boot process, which contains the core devices pre-created so that the boot process has something to work with before udevd is loaded.)
/dev/shm is used by the POSIX shared memory facilities.
/run contains resource locks and PID files etc. which are relevant to currently-running daemons. /var/run and /var/lock are symlinks back to /run for compatibility reasons.
/media contains the mount-points of removable media (e.g. optical discs and USB drives), which are created and removed automatically.
/sys/fs/cgroup contains details for the cgroup system, which is used (mainly by systemd) to divide processes into groups for resource sharing etc.