Today has been a very rewarding day for finding interesting articles. Apart from the articles that I will mentioned in my next article here is one for my readers who runs the Gentoo operating system.
http://apcmag.com/6636/Gentoo tip for the love of tmpfs
Basically the idea is to mount a virtual file-system over the directory that stores temporary files used during compilation of new software (/var/tmp/portage). As most you you might know, Gentoo includes a system that automatically compile and install software for you. The great part is that it is very easy to use, the down part however is that it sometimes takes hours to install a certain software. The Hard Drive being the slowest part in the equation has just to be removed.
To try it out simply add this line to your /etc/fstab file and mount it as root or reboot.
none /var/tmp/portage tmpfs size=212M,nr_inodes=1M 0 0
You might also want to kill the content for the directory before, as it most probably contains lost of useless data which would then be hidden behind the mount.
rm -fr /var/tmp/portage ; mkdir /var/tmp/portage
Now the guy in the article use a 1412M sized tmpfs virtual partition on a 2G of RAM system. I really wonder how this would work on a 512MB RAM system. It might just swap all the time removing the whole idea. So I'm not sure this tricks helps people who really needs help. (the people with regular hardware)
What I really would like to understand is how the tmpfs kernel module know when to delete or not a file from the memory. I'd be afraid that it kills some .o out of the memory before the full compilation comes to an end. Or that it keeps all these temporary files in memory for hours after the compilation is done. I'd like to understand the magic.
For more Linux related article, checkout their Kernel Knowledge page
Update: Then later I found in the comment it is useless to add an extra tmpfs as Gentoo always have one enabled.
And I Quote .... "You can always do this by using the existing tmpfs, /dev/shm. /dev/shm will allocate up to 1/2 of your system RAM for tmpfs and it should already exist. To use it change/add the following three lines to your gentoo /etc/make.conf file:"
PORTAGE_TMPFS="/dev/shm" PORTAGE_TMPDIR="/dev/shm" BUILD_PREFIX="/dev/shm"
Good luck in your trials. And please post comments on your experimentations.

over 1 year later:
It works fine on 512MB memory.
I allocated 2GB for the tmpfs drive. If it runs out of static memory, it will use swap space.
In regards to your concern about a file being erased; Files are only erased if you actually erase them, or a program like portage erases them. Portage clears out /var/tmp/portage when it finishes compiling and installing a package. It is literally a super fast hard drive. As long as you have power, it acts just like a hard drive.
Most programs compile in 512Mb memory, execptions being gcc, kde, xorg-server, etc.
Actually, I even allocate a tmpfs for /tmp itself and for logs.
Gary
over 1 year later:
tmpfs only uses as much ram, as there is really used. so you can allocate 2 GB tmpfs with having 2GB ram and no swapping will occure, unless you fill up the tmpfs.
2) deleting from tmpfs works the same as deleting from hdd/ssd. the kernel doesnt manage the deletetion, it dows anything what it does with any other FS. if the script doesnt clean up by itself, files will stay forever, Or till the next reboot.
over {{count}} years later:
Great read! You might want to follow up to this topic???
over {{count}} years later:
I am not sure where you are getting your information, but great topic