Shell tips

To improve performance or reduce disk i/o for some workload, you can mount /tmp in memory using mount_mfs. When doing so, the new fstab entry would look like this:

swap /tmp mfs rw,nodev,nosuid,-s=800MB 0 0

In this example, we used 800MB, you should adapt according to how much memory you want for /tmp.

You can find your memory size using dmesg and awk:

dmesg | awk '/avail mem/'

Here is a command generating a fstab entry assigning 10% of your memory to /tmp/, you can use it in place of your /tmp/ entry:

printf "swap /tmp mfs rw,nodev,nosuid,-s=%sB 0 0\n" \
$(dmesg |awk '/avail mem/ { print int($4 /10) }')

You need to adjust /tmp permissions:

 # chmod 1777 /tmp