2

When mounting a tmpfs we can pass as an option its (maximum) size and prevent the relevant fs from growing indefinitely and thus consuming all of our RAM, e.g.

$ mkdir -p /tmp/shmemory
$ sudo mount -t tmpfs -o size=1G noname /tmp/shmemory/

$ mount | grep -i shmem
noname on /tmp/shmemory type tmpfs (rw,relatime,size=1048576k)

However I do not see any size option in the /dev/shmem tmpfs dir that is present on my machine (and in most modern linux distributions)

$ mount | grep -iE "shm\s"
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)

Does this mean the above can grow without any limit whatsoever?

1 Answer 1

1

mount never shows the size of filesystem.

Use df instead:

df /tmp/shmemory

That will show you desired information.

1
  • I accepted your answer as the df command does show the size of the particular fs. However I am still wondering why in the tmpfs I created manually the size is given via the mount command while in /dev/shm is not;
    – pkaramol
    Commented Apr 22, 2019 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .