I have 4 GB of RAM but so far never needed more than half of them, so one day I told me: «why don’t I move /tmp into the RAM so that it’s faster?» (it also has some other benefits, like that when you power off the data there gets removed in a more safely manner than if it had been written to the hard disk, but I won’t get into this now; I don’t want to convince anyone to do the same, but just explain it for those who might have the same idea).

To achieve this the only thing I had to do is open /etc/fstab and add the following line to it (this works on both Ubuntu Jaunty and Debian Lenny):

none /tmp tmpfs nr_inodes=200k,mode=01777,nosuid,nodev 0 0

(By default, up to half of the RAM is allocated for /tmp; you can override this value adding the «size» option; eg., «size=2G» to give it 2 GB or «size=1G» to give it only one).

Some people advice to do this change in a recovery console, but I did it live from my normal session and it works as well; just don’t forget to apply the change with the following commands if you do it like me:

sudo mv /tmp /tmp-orig; sudo mkdir /tmp; sudo mount /tmp; sudo mv /tmp-orig/* /tmp; sudo mv /tmp-orig/.* /tmp; sudo rmdir /tmp-orig