Tmpfs and memory not sync

Description

  1. no swap
  2. mount tmpfs to a folder, 8GB
  3. full fill the folder
  4. memory usage is 4GB (KSysGuard)

Question

Why is the memory usage so small in this case?
It says that tmpfs consumes VM, which is swap + physical memroy.

tmpfs makes applications faster on loaded systems as it’s stored in volatile memory instead of a persistent storage device.
swap which is low-level storage used by the virtual memory manager, helps the system release RAM when full in some situations.

Load more applications, open up browsers with multiple tabs. Things will change. In a way is as you apply different force (and not always maximum force) when lifting a cup of tea or 20Kg of groceries …

Totally 16GB memory, no swap partition, fill tmpfs with 8GB, but physical memoy usage shown by KSysGuard is about 4GB, it should be above 8GB, right?

don’t quite know what you want to investigate here, but:
how did you

  • mount tmpfs to a folder, 8GB
    and how did you
  • full fill the folder
    ?

and why do you think what is should not be as it is?

I happened to full fill a folder that’s mounted with tmpfs, but found physical memory had not been consumed accordingly.

e.g. /etc/fstab

tmpfs /home/abc/Downloads tmpfs rw,noatime,nodiratime,nodev,nosuid,nr_inodes=5M,size=8G,uid=abc,gid=abc,mode=1700 0 0

In practice, I downloaded a file larger than 8G to folder /home/abc/Downloads in FileZilla,
the result is that the file is truncated to 8G.

If /home/abc/Downloads contain a file whose size is 8GB, it should consume 8GB physical memory, right? But it doesn’t.

I’d have to research and learn about what tmpfs is, how it is supposed to work, and so on
It is a virtual filesystem, from what I know - not real

Swap is also related to how linux works with virtual memory.

Not having swap is probably not a prudent decision in any home device usage scenario - but this is my opinion, it may not be a fact.

You think it should.
But, based upon what tmpfs is and how it works
should it really?

btw:

/home/abc/Downloads

is also, before that, already mounted wherever /home is mounted

I do not want to argue.
I just don’t see and think that anything is off here.

Except perhaps your understanding of what tmpfs is and how it works …

tmpfs usage doesn’t show as memory used but it does register as memory not being available anymore.
Check with:

$ free -h

buff/cache should increase (and available should decrease) when tmpfs fills up.

2 Likes

Alright, the detailed result from free -h is ok, KSysGuard only shows the used memory.


# Before copying files (about 4GB)
$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       792Mi        13Gi        89Mi       755Mi        14Gi
Swap:             0B          0B          0B

# After copying files (about 4GB)
$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       892Mi       5.1Gi       4.4Gi       9.5Gi       9.9Gi
Swap:             0B          0B          0B

Thanks

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.