Swap space considerations

The standard desktop Solaris machine in Rutgers DCS is configured with 250M of swap space. This disk partition serves two purposes: swap and /tmp. Swap space on disk adds to the amount of virtual memory available to the machine. Files put in /tmp also reside on this partition.

/tmp is a tmpfs

In our standard configuration, /tmp is not a regular local filesystem; it is a tmpfs file system. That is, space for it is allocated out of swap space. Therefore, swapping and /tmp files compete for the same resource. From the tmpfs man page:
Users of tmpfs should be aware of some constraints involved in mounting a tmpfs filesystem. The resources used by tmpfs are the same as those used when commands are executed (for example, swap space allocation). This means that large sized tmpfs files can affect the amount of space left over for programs to execute. Likewise, programs requiring large amounts of memory use up the space available to tmpfs.
Put simply, this means if a program runs the machine out of swap space, /tmp will fill up, and if large files fill up /tmp programs will not be able to get any memory to run.

If this restriction becomes a problem for you, a separate disk partition can be allocated for /tmp.

Why do we set up /tmp this way?

If it has the potential for leading to the troubles outlined above, why do we do it at all? Because space needed for /tmp and swap are variable. They are both allocated out of the same limited resource (local disk space). By sharing the swap partition, if swap usage is low, you get more space to use in /tmp. Conversely, if your /tmp usage is low, you get the space to use for swapping. Also, since regular disk partitions require waiting for I/O for file creation/deletion and read/writes, a partition kept in (virtual) memory is much faster.

Local scratch area or separate /tmp partition

If you need a separate partition for /tmp, or need a local scratch directory which is not cleared when the machine is rebooted, the swap partition can be split in two to get a new partition. The typical size for a local scratch area it 100M. This leaves only 150M for swap (see restrictions above), but as long as you're aware of that, it should be no problem. These local scratch areas are not backed up.
This page last updated March 4, 1997.