Whats the use of temporary filesystems in RHEL 7 ?

After the installation of RHEL 7 we can see temporary  filesystems in output of df. Whats the purpose of these filesystem I will explain in this article.
Okay, here is the output of df from RHEL 7.1 which is same for RHEL 7 as well. Filesystems in question are “/dev/” “/dev/shm” “/run” and “/sys/fs/cgroup”.

[root@Node71 ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   11G  3.3G  7.1G  32% /
devtmpfs               908M     0  908M   0% /dev
tmpfs                  917M   92K  917M   1% /dev/shm
tmpfs                  917M  8.9M  908M   1% /run
tmpfs                  917M     0  917M   0% /sys/fs/cgroup
/dev/sda1              497M  124M  373M  25% /boot

If you look closely three of them are of same size and devtmpfs is of bit different size.

RAM assigned to my test VM is 2GB. As all these are temporary filesystem so they are taking the space from the RAM. If we count all of them then total will become 3659 MB (3.5GB approx).

Now question arises how this is possible ?

Answer is these are virtual filesystem remember hence they are taking 3.5 GB RAM even though the system is having 2 GB RAM.

Another question may arise what will happen if all the filesystems got full ?

This condition can’t happen because the system would run into problems much before that. Lets see how much RAM they are currently using in blocks.

Here is how much memory is used by each filesystem (in 1k blocks):

Filesystem            1K-blocks    Used Available Use% Mounted on
devtmpfs                 928872       0    928872   0% /dev
tmpfs                    938832      92    938740   1% /dev/shm
tmpfs                    938832    9096    929736   1% /run
tmpfs                    938832       0    938832   0% /sys/fs/cgroup

Total Used is :        9182

So, although all those filesystems together could use 3.5 GB, they are only using 9MB.

/dev is used to store device nodes.  It should never claim to use memory.
/sys/fs/cgroup is used for cgroups.  It will use very little memory.
/run is used for system logs, and other daemon related files.  It is unlikely to grow to anywhere near the maximum size of the filesystem.
/dev/shm is used for temporary files.  It is intended to be used for shared memory allocations.

Of all of these file systems, /dev/shm is the only one that normal users can write to, so the only one that may use a significant amount of memory.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s