tmpfs question - mounting directories on it.

It’s pretty clear that I can create a a tmpfs mounted on some directory called for instance ramdisk. What’s not clear is if there can be other directories under the one mounted as tmpfs and still be in tmpfs?

That is

… …Directory A
-RamDisk ./

…Directory B

I ask because every example I can find doesn’t make any mention of sub directories but more or less do say it’s just a file system so i assume should be able to hold a directory structure.


Sure, look at what is under tmpfs on your running system with the mount command. You will see one with your user id you can make a directory under there etc. It’s just dependent on your ram… then there is things like zram etc

I have 24gb of ram. My impression is that Linux and KDE don’t need anything like that amount. One of the reason I asked the question was this from a df -h command.

devtmpfs         12G  8.0K   12G   1% /dev
tmpfs            12G   38M   12G   1% /dev/shm
tmpfs            12G  3.0M   12G   1% /run
tmpfs            12G     0   12G   0% /sys/fs/cgroup
tmpfs           2.4G     0  2.4G   0% /run/user/478
tmpfs           2.4G   24K  2.4G   1% /run/user/1000

The install set that up but shown this way it looks like each directory under run have been allowed to grow to 2.4gb so it’s 2 tmpfs mounts not a single one. Then there are 3 others all 11.74 gb - doesn’t make sense so must be one 11.74gb tmpfs system. One of those is /run so /run goes to a 11.74gb and run/user/478 and run/user/1000 go to ones that can reach a size of 2.4gb. So I suppose must be a max allocation of 2.4gb for each user with a total limit of 12gb.

;)Anyway without asking it isn’t clear.

Some how I wonder if these default %'s are dated and based on systems with a lot less ram and if a really large cache is ever needed they might even interfere with just how big that can be. Currently I have a total usage in these of about 42mb.


I’m a gnome user, have no idea about KDE stuff… strange you have a systemd user running?? It allocates half the ram for devtmpfs, of that /run/user is separate at 10% of ram (see the output from mount).

But what’s the point of all that ram if you don’t use it… :wink:

Tweak swappiness so ram is utilized before disk swap…

I’ve noticed those anomalies,
And have speculated without doing further research that the tmpfs mounts only reserve virtual memory addresses and sin’t related to physical memory addresses. In any case, each tmpfs mount size is exactly the same on every system no matter the amount of physical RAM.

So, as you know on a 64-bit system the memory map is enormous and is the same size regardless how much physical RAM (and swap) you might have in your system.


Half the physical ram…

size: The limit of allocated bytes for this tmpfs instance. The
default is half of your physical RAM without swap. If you
oversize your tmpfs instances the machine will deadlock
since the OOM handler will not be able to free that memory.

YAST shows each tmpfs as a totally separate mount. I don’t really want to do that so will try just adding directories off the one declared as tmpfs and see what happens.

No chance of my machine using swap as I am running without a swap partition.

Actually memory usage is interesting

 free && sync && echo 3 > /proc/sys/vm/drop_caches && free
             total       used       free     shared    buffers     cached
Mem:      24616644    7120560   17496084     104312     477504    5148804
-/+ buffers/cache:    1494252   23122392
Swap:            0          0          0
             total       used       free     shared    buffers     cached
Mem:      24616644    1950000   22666644     104312       1704     468364
-/+ buffers/cache:    1479932   23136712
Swap:            0          0          0

The high usage is mostly down to firefox. I’m now running that with it’s cache set to zero. The change in memory usage when the cache is cleared is about the same as it was when I had it’s cache enabled. In fact this cleared figure is lower than it usually is.

I find these areas on OS’s frustrating. Probably because my first real software related job was a dec server. It came with in excess of 6ft of manuals that explained everything that went on in it.