Information about starting and operating an ISP or corporate Intranet using Linux servers.

Server Performance

A collection of tips to help increase performance of a server (or desktop) machine.

Portage cache in tmpfs

When compiling packages, as is frequently done on Gentoo systems, there is a lot of hard disk activity as packages are unpacked, compiled, and then erased. This activity is perfect for tmpfs.

mkdir -m 777 /mnt/portage-tmp
mount -t tmpfs -o size=1g -o mode=777 tmpfs /mnt/portage-tmp

Where:

  • -t tmpfs specifies the filesystem type
  • -o size=1g specifies the size to be 1GB. Default is 50% of RAM, although memory is allocated, released, or moved to swap as needed.
  • -o mode=777 specifies the directory mode bits (permissions) to allow all users to write to it
  • tmps specifies the device name
  • /mnt/portage-tmp is the mount location

Some large packages need 500MB or more – the 2.6.37 kernel is ~473MB, boost runs a bit over 500MB, and then there's OpenOffice which will need Gigabytes of space. tmpfs will grow and shrink, so it does not remove the memory assigned to it from available RAM unless used, so the default 50% size setting may be the best idea.

Set or change the Portage temporary directory setting in your /etc/make.conf file:

PORTAGE_TMPDIR=/mnt/portage-tmp

Now compile something and you'll be pleased that you hardly hear the hard disks clicking any longer.

For in-depth details about tmpfs see this document from kernel.org or simply view the text files in the Documentation/filesystems/ directory of your kernel sources (e.g., /usr/src/linux/Documentation/filesystems/).

Navigation
Print/export
Toolbox