←back to thread

62 points hiAndrewQuinn | 1 comments | | HN request time: 0.2s | source
Show context
hackyhacky ◴[] No.44392515[source]
Rather than re-write your scripts to store temp files into /dev/shm, you can just mount /tmp using the tmpfs file system and get the same benefit for all your programs. Some distros do this by default.

The relevant line from fstab is:

    tmpfs /tmp            tmpfs    noatime 0       2
Now any program that writes to /tmp will be writing to a RAM disk, thus sparing unnecessary wear on my SSD.
replies(7): >>44392526 #>>44392690 #>>44392745 #>>44392789 #>>44392847 #>>44393129 #>>44393836 #
pkulak ◴[] No.44392745[source]
I did this for a while, but writing files to ram can be dangerous, since most things assume unlimited disk space. I noticed that updates would fail on machines that had 16 gigs of ram unless I logged out of my window manager and did it from the TTY. Took quite a long time to realize it was because of all the compiles writing to /tmp. Much easier to just let the SSD get used.
replies(1): >>44392802 #
buckle8017 ◴[] No.44392802[source]
This is why having swap even when you have plenty of memory for normal usage is good.

Swap on an SSD isn't even that slow.

replies(2): >>44392866 #>>44392886 #
1. ◴[] No.44392886[source]