Hacker News new | ask | show | jobs
by anon___ 1221 days ago
I have more RAM than I need, and just the other day I set up a RAM disk to put my /tmp directory on. My comic reader unpacks huge rar and zip archives into /tmp at every run, and I don't want it to wear out my SSD. I put this line in /etc/fstab:

  none  /tmp  tmpfs  defaults,size=4G  0  0
It works like a charm. And in the worst case, if I run out of RAM anyway, it readily swaps out.
2 comments

This is a commonly recommended thing to do! It helps IPC performance in some ways - also makes sure nothing in there persists longer than intended.

You might consider these common mount options for a little extra security:

    noexec,nosuid,nodev
(and potential headaches, to be fair)

While /tmp is a great world-writable place, these restrict it from being home to executables/devices -- common sources of abuse

Thank you for the tips! It was just a quick hack and I never knew much about the mount options, but I guess it's time to learn.
Certainly!

I picked these up through some compliance benchmarks, commonly applied to /tmp -- I'd exercise caution with these elsewhere, they're fairly restrictive

You could also do https://wiki.archlinux.org/title/Firefox/Profile_on_RAM , or more generally https://wiki.archlinux.org/title/Profile-sync-daemon or https://wiki.archlinux.org/title/Anything-sync-daemon

Or just skip that install to media stuff altogether, and run from some live distro booted into RAM, and running from there :-)