Portage TMPDIR on tmpfs

When emerging packages it is possible to build them in tmpfs (RAM) space instead of having build files pushed and pulled to Hard Disk Drive (HHD) or Solid State Drive (SSD) space. Building in tmpfs both speeds up emerge times and reduces HHD/SSD wearing. If your system contains a SSD, it is generally a good idea to have Portage compile using RAM instead burning up the SSDs precious write cycles (especially on something like compiling software).

fstab
You can mount Portage's TMPDIR to tmpfs by adding the following to the system's fstab config file:

After the fstab has been modified, it is possible to mount Portage's TMPDIR to RAM by using this command:

Considering tmpfs Size
The system's tmpfs space should be large enough to handle the largest packages to be compiled on the system. If the tmpfs space were to ever become completely full then the emerge will fail. Most packages do not need more than 1 GB of tmpfs space their compiles, but there are few very large packages. If you have a lot of RAM, setting Be careful to include enough tmpfs space when installing the following packages:


 * 10GBs or so.


 * More than 2GBs.


 * More than 4 GiB.

Per package choice for TMPFS or HDD
You can configure Portage to build large packages outside of the tmpfs space on a per-package basis.

Create a file to tell Portage where to place the temporary files directory:

Create a separate temporary file directory outside of the tmpfs mount location:

Create the file in which you will list all the packages that need some special environment variable settings.