DevHeads.net

Does devtmps and tmpfs use underlying hard disk storage or Physical Memory (RAM)

Hi,

I am running the below command on CentOS Linux release 7.6.1810 (Core)

# df -hT --total
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda1 xfs 150G 8.0G 143G 6% /
devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs tmpfs 7.8G 817M 7.0G 11% /run
tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/995
tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/1000
total - 185G 8.8G 176G 5% -
#

Does devtmpfs and tmpfs use underlying hard disk storage or does it uses
Physical Memory (RAM). What is the purpose of devtmpfs which is mounted on
/dev, tmpfs mounted on /dev/shm and so on and so forth. What is the
difference between devtmpfs and tmpfs?

I will appreciate if anyone can help me understand the above output.

Thanks in Advance and i look forward to hearing from you.

Best Regards,

Kaushal

Comments

Re: Does devtmps and tmpfs use underlying hard disk sto

By Steven Tardy at 04/20/2019 - 21:09

On Fri, Apr 19, 2019 at 8:51 PM Kaushal Shriyan < ... at gmail dot com>
wrote:

tmpfs *tries* not to use disk. /dev/shm is great to use as *fast* large
scratch space.

Have used /dev/shm to greatly speed up a daily process to parse web server
logs. Didn’t /seem/ like the process was IO or disk bound. . . Until I
threw the logs in /dev/shm and a multi hour process completed in 1/4 the
time.

Have used /dev/shm for other “things”.

There is /dev/ram# which should never be written to disk, but has the
problem of being much much smaller (4MB iirc) and no filesystem access. So
you’d have to `mkfs /dev/ram#` and then `mount /dev/ram# /somewhere`.

Once used /dev/ram# for USB camera “security system”. The camera gave
large-ish files and couldn’t figure out how to get the camera app to output
to stdOut to then shrink the file to a tiny jpeg with pipes. So had the
camera write to /dev/ram and then read the file from /dev/ram through
`convert` or something to jpeg-ify the image. Greatly sped up (like 2-3x)
how often that could save images.

Happy learning how to Linux. (:

Re: Does devtmps and tmpfs use underlying hard disk sto

By Yamaban at 04/20/2019 - 03:45

"Per Principa" are both, - devtmpfs and tmpfs - RAM based, BUT, pages
of RAM can be stored on disk/ssd via use of swap, same as any other
RAM usage.

Whats the difference between devtmpfs and tmpfs?
For the normal user none.

Original toughts for devtmpfs where based where based around reducing
the needed memory per entry, because /dev {excluding /dev/shm}
should only contain device-nodes, or links witch both are stored as
directory-entries without data-inodes-entries, later direcories where
included.

While tmpfs is similar to other on-disk-filesystems capable of storing
files with a size greater than zero. "/dev/shm" was the first in-ram-fs
available to the casual user without extra work.

What is the difference with the actual kernels?
I would have to look into the kernel source, as my detail knowlegde
of the matter is dated.

- Yamaban.

Re: Does devtmps and tmpfs use underlying hard disk sto

By Pete Biggs at 04/20/2019 - 03:23

On Sat, 2019-04-20 at 06:21 +0530, Kaushal Shriyan wrote:
It uses RAM, that's what 'tmpfs' is, a temporary RAM filesystem.

devtmpfs is a kernel maintained filesystem of automated device nodes.

tmpfs is a RAM disk.

Google really is your friend here.

P.