Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On Solaris, the /tmp filesystem is a filesystem of type "tmpfs". It's implemented in the kernel by allocated space from the virtual memory pool. That means allocation interacts with the available RAM on the machine and the swap space available.

If I have a large-memory machine (lots of RAM) with a smaller sized moderate swap partition, will the size of my /tmp space be limited by the memory, or by the swap space, or by the sum of both of them?

The number shown by "df -h /tmp" doesn't seem to reflect the free RAM, only the swap space.

share|improve this question

1 Answer 1

Here's what I know so far. I'll put this here in the hopes that it's useful, but refinements are welcome.

The sum of swap space and RAM should be available for use by /tmp files. You can read more about it in the man pages for tmpfs, mount_tmpfs and swap.

Here are some relevant docs:

Oracle Solaris 11.1 Administration: Devices and File Systems http://docs.oracle.com/cd/E26502_01/html/E29006/fsswap-29713.html

At the end of the tmpfs man page I found this:

 df(1M) output is of limited accuracy since a tmpfs file sys-
 tem  size  is not static and the space available to tmpfs is
 dependent on the swap space demands of the entire system.

Oracle support document 1007407.1 suggests that the implementation reports out of space if this condition becomes true:

 ((RAM + swap - process-space) * .9) - space-from-files-in-tmp = 0

That seems to indicate that some sort of fudge factor is involved.

My interpretation of that formula is that running processes are allowed to get much closer to the true limit of the memory+swap. Space allocated in /tmp will start to fail when the free space in (RAM+swap) gets close to 10%. If you have large RAM (like 128G) and small default swap (like 4G), then this means that /tmp could report that it is full before any pages are allocated from the swap space at all. Nothing is wrong with that, it's just a curious twist on the traditional virtual memory algorithms and assumptions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.