SUMMARY: Swap space changing size

From: John Clinton (
Date: Thu Jan 28 1999 - 13:16:36 CST

Hi Sun Managers,

Thanks to all who responded.

My machine was basically sharing /tmp and swap.

Suzanne Taylor <> replied with:

Excerpt from Sunsolve:
Document ID: 1282
SYNOPSIS: Swap space and tmp

Adding more swap space using "swap -a" doesn't always solve problem.
Solaris as shipped allows tmp and swap to share space. The relationship
of disk space utilization is not often clear. The use of tmp "robs"
swap space and the use of swap robs tmp space. In many situations a
system will run out of tmp space first and manafest a shortage of swap
space. Other strange system behavior i.e. core dumps in addition to
swap and tmp errors.

From: (John Keeton)
To tell who is hogging memory, cd /proc ; ls */as ; as is the core memory
size, and will let you know how much memory an app is using.

Grant Schoep <> described the the process well:
/tmp is memory. /tmp mounts on /tmpfs, which is real memory, RAM. If there
is a process taking up lots of your real memory, /tmp will be reduced. Same
thing goes for if you do a mkfile in /tmp, watch your real ram decrease.
Make a real large file in there, and watch your real ram decrease, lots of
swapping occur, then it go up. Its how swapping works.

"David Evans" <> mentioned:
A good description of this can be found in Adrian Crockcrofts columns
in SunWorld On Line ( or in his book on the
same subject.

I will probably use: Peter Polasek <> suggestion and
mount /tmp as a true file system:

Since you don't have an abundance of memory on your
system, your best bet is to disable tmpfs and mount it as a true disk
partition by commenting out the following line in /etc/vfstab:

#swap - /tmp tmpfs - yes -

Thanks to all others who responded. Too many to post all the responses

My original post follows:

An interesting problem has just cropped up on our Ultra 2. The box is
configured as follows:

Solaris 2.6
Two 9 GB hard disk (mirrored)
Two 4 GB hard disk (mirrored)
vxva version 2.4
vxvm version =?? I don't know how to verify this
All hard disks are configured in a single disk group called: rootdg

The primary application on this server is HP OpenView 5.x

An inspection of swap space (/tmp) showed that it was completely full. This
was of course a surprise to us. However, the df command showed the total
space for /tmp as 8 MB (yes 8 MB, not a typo). A quick clean up under /tmp
provided about 4 MB free space.

By re-running the df command a few minutes later, /tmp was now about 6 MB
total space. By re-running the df command every few seconds, /tmp was
changing size + or - of about 100K or more.

/tmp should be about 512 MB. This was verified by Volume Manager and using
the swap command.

This server has been up for 87 days. I recall inspecting /tmp about a month
ago and the size was correctly stated at 512 MB.

Assuming /tmp did not mount correctly, I attempted to mount /tmp via the
volume manager and the volume manager indicated /tmp was already mounted.

We added temporary space to /tmp to keep things happy by executing:

#mkfile -v 500m /opt/file00.swap
#swap -a /opt/file00.swap

the output of the df -k command now shows:

Filesystem kbytes used avail capacity Mounted on
swap 640168 3648 636520 1% /tmp

By re-running df -k again:
Filesystem kbytes used avail capacity Mounted on
swap 640520 3648 636872 1% /tmp

As you can see, /tmp is dynamically changing.

The swap command shows:

#swap -l
swapfile dev swaplo blocks free
/dev/vx/dsk/swapvol 134,5 16 1047584 98000
/opt/file00.swap - 16 1023984 929136

As you can see /tmp should have been around 512 MB. Block size is 512
/opt/file00.swap is the temporary space we just added.

Any ideas of why /tmp decided to reduce its size to 8 MB? Also, any clue as
to why it is dynamically changing its size?

John Clinton

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:14 CDT