←back to thread

62 points hiAndrewQuinn | 2 comments | | HN request time: 0.409s | 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 #
hiAndrewQuinn ◴[] No.44392526[source]
I do mention this offhand in the article: "The existence of /dev/shm is a boon for me mostly because it means I never have to worry about whether /tmp is really RAM-based again."
replies(2): >>44392561 #>>44392655 #
frollogaston ◴[] No.44392655[source]
"virtually every Unix system already has it mounted as a tmpfs by default" might be true if you say Linux instead, but Mac doesn't have /dev/shm
replies(3): >>44392705 #>>44392793 #>>44392859 #
1. loeg ◴[] No.44392705[source]
I may misremember, but I think it's also common in the BSDs? (Whereas /var/tmp is persisted.)
replies(1): >>44400967 #
2. frollogaston ◴[] No.44400967[source]
Yeah, Mac is probably the odd one out, but it's also maybe the most common Unix-based/Unix-like desktop OS. Anyway, both are POSIX, unlike Linux.