I knew about ccache long time ago, also knew about shm (shared memory) on Linux but I realized that I could:

1. Mount my tmp partition on shm, so all the temporary files would be written on RAM, instead of HDD.

2. Now I set the ccache directory to my tmp directory, this way the ccache files will be written directly to RAM, gaining a better performance than usual.

Now add the following lines to /etc/fstab:

/dev/shm                /tmp              tmpfs           defaults,size=80m,auto 0 0

/dev/shm                /var/tmp          tmpfs           defaults,size=80m,auto 0 0

It is defining 80MB for maximum RAM usage by temporary files, you can define more or less memory, as you wish, of course. The flag “auto” defines that these partitions should be loaded automatically at the boot time.

Now add the folowing line for the /etc/make.conf:


This way, ccache will write to your RAM. Now you can try recompiling your whole system with emerge for a test, you’re gonna realize that your HDD won’t get much stress when compiling the sources, since all the temporary files generated during the compiling process are now written directly to RAM.

I will not get into deeper details about ccache and shm, so I suggest you to read the “references”, if you want to know some more.


#man ccache




http://ccache.samba.org/ (official website)


http://www.tuxfiles.org/linuxhelp/fstab.html (fstab tutorial)

About these ads