How to move temp files to RAM?

I want to move my temp file system to ram to improve some performance in browsers, etc. How do I do it in simple way?

Usually it is by default.
tmpfs correlates to /tmp/

You can find out more here:

But it sounds like you particularly want your browser profile on tmpfs … which can be accomplished by

Oh yeah … heres browser-specific articles:

You can make a small ramdisk and add this script to /etc/profile.d and make it executable.

# save in /etc/profile.d to make X programs like chromium/firefox remap cache directory to ramdisk

if [ $USER ]; then
  export XDG_CACHE_HOME="/path/to/ramdisk/${USER}/.cache"

Wont that map everything that uses the variable for ‘user home .cache folder’ to tmpfs ?

Not saying it might not be desired … but it wont only affect ff/chrom, right?

True it remaps the whole .cache folder. I use it and it doesn’t cause me any issues.

I might not expect it to … probably depends … maybe some document service does its autosaves there and you rely on it … but it goes to tmpfs, so its lost on next reboot?

For me … I generally walk into that directory and swing a big sword whenever the mood is right.
So it probably wouldnt bother me either :grin:

I use PSD which is enough for FF, but chrom* I additionally put a line in fstab:

tmpfs   /home/USERNAME/.cache/chromium     tmpfs   noatime,nodev,nosuid,size=600M  0       0

I’ll keep that solution in mind. For Firefox I just edit about:config

I found that script on the web and mostly use it for the Chromium cache.

So basically I should add this line to /etc/fstab ?
tmpfs /tmp tmpfs rw,nodev,nosuid,size=2G 0 0

If you feel you need to set it manually.
Similarly you can use the tmp service, or configuration:

By default /tmp should already be tmpfs …

systemctl status tmp.mount

Oh you are right. It says tmp.mount is already active. So i don’t have to do anything more?

tmp is mounted as tmpfs by default (as half your ram)

1 Like

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