Consider the practice of mounting the /tmp directory on a tmpfs memory based filesystem, as can be done with: systemctl enable tmp.mount

And consider the following:

one justification: The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing.


another justification: Some applications writing files in the /tmp directory can see huge improvements when memory is used instead of disk.

Is disk caching always in effect? By that I mean when you write to any folder (not just /tmp) you are probably writing to RAM anyway until such time it gets flushed to disk... the kernel handles all this under the hood and it is my opinion I don't need to go meddling tweaking things. So does doing systemctl enable tmp.mount has any real value, if so what?

Also (in CentOS-7.6) I am testing this to try and understand what's happening I am experiencing:

  • CentOS 7.6 installed on one 500GB SSD with simple disk partitioning as
    • 1GB /dev/sda1 as /boot
    • 100MB /dev/sda2 as /boot/efi
    • 475GB /dev/sda3 as /
  • PC has 8GB of DDR-4 RAM
  • if I do just systemctl enable tmp.mount I then get
    • 3.9GB tmpfs as /tmp

How is this tmpfs /tmp at 3.9GB any better than the default way which would (a) first have up to ~8GB based on RAM thanks to disk caching and (b) then when disk caching at capacity based on 8GB of RAM there is > 400GB of disk available to use ?

1 Answer 1


Whether this configuration "adds value" depends entirely on the use-case in question. "Good", "bad", these are not valid labels for different configuration options without context.

For systems with a lot of RAM and high transaction numbers, the tmpfs filesystem would probably increase performance (example: a Type-2 hypervisor). This might be "good" use case.

Alternatively, systems with a small amount of ram but plenty of storage (example: any of the Internet-of-Things crap made these days) probably perform better with physically written /tmp storage devices, since anything in memory can be written to swap if underutilized (if swap is activated as well). This could be considered a "bad" case for tmpfs /tmp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.