/tmp & swap on Solaris2.4

2007-12-25 8:57:00

Thanks for some great answers! I have moved my /tmp to a partition rather

than make use of the swap area. I have a giant comment in /etc/vfstab to

reminde me to change this back when/if I need to upgrade the OS--thanks for

the tip Sue.

Joe

:-)

 ____________________________________________________________________

Original Question:

I have looked around at faq and not found a good overall answer....

I have been using SunOS4.1.3 for some time and Solaris 2.4 is still a little

new...

Could someone clear up the association between "swap" and "/tmp" for me....

I am running some software that likes to use /tmp and this eats at my swap

space....I think...I've made swap=/tmp about 70mb for a 32mbRAM system

I would like to move /tmp... but I don't know how this will effect Solaris

2.4...I would like to set up "/tmp" so it is used like a SunOS4.1.3 system.

Original Question:

 ____________________________________________________________________

Summary of Replies:

 ____________________________________________________________________

From: Chris Terry/Computervision

  <Chris_Terry/Computervision@ausns1.cv.com>

Joe,

As you have noticed the default action with Solaris 2 is to use tmpfs or any

swap not in use rather than an area on disk (you had to turn it on specifically

in 4.1.3). To turn it off, i believe that you just comment out the swap mount

line in /etc/vfstab.

Chris

 ____________________________________________________________________

From: tanner@george.arc.nasa.gov (Rob Tanner)

tmpfs (where swap is used as /tmp) is available both in SunOS4.1.3

and Solaris -- you had to enable it in SunOS4.1.3 and it is the

default in Solaris.

The requirement for backing store in Solaris is greatly reduced by

virtue of virtual swap which is new in Solaris. The 70mb you have

allocated for real physical swap is really overkill, so if you have

some real /tmp hungry applications, don't worry that much unless your

seeing other problem as well.

The command "swap -s" will give you a good idea of the used/available

ratios. Also, look at the last line of output from "vmstat 30 2" (and

ignore the line immediately above it). Under the column labelled swap

you will find the avarage available swap and under free the free

memory (all in Kbytes). swap should be 10,000K or above. Don't worry

about it unless the swap value falls below 10,000k for frequent

periods. The column labelled "sr" is the pagedaemon scan rate. If

it's under 200 you've got lots of memory. If it's near zero, your not

even paging, much less swapping.

Hope this helps.

-- Rob

 ____________________________________________________________________

From: see@uebemc.siemens.de (Michael Seeger)

Under Solaris swap gets mounted on /tmp.

This is done in /etc/vfstab by the line

#device device mount FS fsck mount mount

#to mount to fsck point type pass at boot options

#

swap - /tmp tmpfs - yes -

So if you start writing to /tmp your available swapspace decreases. This

may cause problems if you have applications that make heavy use of memory,

or a highly loaded system, plus writing a lot to /tmp/.

If you take this out of /etc/vfstab the system works ok, you loose

your fast /tmp-filesystem but your are now free to link /tmp to what ever

you want, for example make /tmp a link to /export/home/tmp.

hope this helps

Michael

 ____________________________________________________________________

From: brobbins@newbridge.com (Bert Robbins)

1) Increase the swap space, either by adding another swap partition or

   creating a file on an existing partition and doing a swap on.

2) Add a disk partition and mount it at the /tmp directory.

Bert Robbins Newbridge Networks Inc.

 ____________________________________________________________________

From: "Susan M. Menig" <ddq251f@shoes.bell-atl.com>

You can set it up as a regular file system under Solaris 2.x, but I'd recommend

extending your swap space if you've got an unused partition laying around.

Solaris 2.x expects that /tmp is set up as a tmpfs file system (you can also

set it up like that under 4.1.x if you want - see the man page on tmpfs). You

get bit if /tmp is a regular file system when you go to upgrade. At the last

site I worked at, all the servers traditionally had /tmp as a mounted file

system. In the spirit of being consistant, I set up our first Solaris 2.x

server in the same manner. Everything worked just fine until I went to upgrade

to 2.3. Oh boy, that was a long night. The upgrade failed and left the system

in an unrecoverable state (the packages didn't get installed properly). I had

been called away shortly after starting the upgrade - everything looked like

it was going smoothely and by the time I got back :-(... I ended up spending

until around 2 a.m. restoring 2.2 since the machine had to be there in the

morning and I wasn't sure of exactly what had gone wrong. Needless to say, I

experimented on my own workstation to see the error of my ways. As soon as I

used tmpfs for /tmp is was as happy as a pig in sh*t. Moral of the story - if

you do decide to use a mountable /tmp, make sure you remember to change it back

to tmpfs before doing an upgrade (or at least leave notes for your successors -

unless you don't like them). Have fun ;-).

Sue

 ____________________________________________________________________

From: Richard Pieri <ratinox@unilab.dfci.harvard.edu>

By default under System V R4, the /tmp volume is actually part of your

swap space. Your swap is the virtual memory paging space on whatever

disks you put it on. The reason for putting /tmp there is that access to

swap disk space is faster than standard filesystem read/write, so it's a

win for temporary files that are quickly created and destroyed, such as

cpp output. The drawbacks are that it gets wiped whenever the machine is

rebooted, because in effect /tmp is a RAMdisk, and if /tmp fills up you

can run out of swap space very quickly.

If you want to put /tmp onto a real, physical disk, there's no reason

you can't. You can expect to see a bit of performance degradation with

some apps, but it won't hurt to move it. It's a good idea if you want

your temp space to be a bit less transient.

 ____________________________________________________________________

From: Jeff Victor <victoj@kellas.sage.edu>

You could make /tmp a "regular-old" disk partition, by replacing the line

in /etc/vfstab:

swap - /tmp tmpfs - yes -

with:

/dev/dsk/cXtYd0sZ /dev/rdsk/cXtYd0sZ /tmp ufs 1 yes -

However, most people think "I've got all this space in my /tmp partition

which is almost never used", and "I've got all this space in my swap

partition which is almost never used". So somebody came up with the idea

of combining them. (Ironically, it's also faster, as it allows the

system to use the (perverse) in-memory swap space. :-) )

The risk is that this new combined partition may be filled up by people

writing to /tmp, thus using up all the swap space and crashing the system.

My solution was to add the "size=" mount option to the vfstab line:

swap - /tmp tmpfs - yes size=400m

See the man pages tmpfs(7) and mount_tmpfs(1M) for more on the size

option as used here.

 ____________________________________________________________________

From: obrien@sea.legent.com (David O'Brien)

Well, Solaris wants us to use the same raw disk partition for both /tmp

and swap. But I'm sure you've gotten that idea.

IMHO, you should go the standard Solaris way. But, you should allocate

more than 2 times RAM (i.e. the SunOS 4.x rule) for the swap partition.

It seems that writes and reads to /tmp are much faster in the new tmpfs

way than the old way of having tmp on a unix file system. Since /tmp

is used so much in compiles and such, I want this faster speed. At

least is feels faster.

 ____________________________________________________________________

Comments

Got something to say?

You must be logged in to post a comment.