Avatar of samri
samriFlag for Malaysia

asked on 

Problem with Swap on Sun Ultra running Solaris 2.5.1

I noticed (today) that the the allocation for swap is changing (not fixed) overtime, and causing the system to crash (/tmp full).  Everytime, I had to recycle the server.

The mahicne is Sun Ultra running Solaris 2.5.1.

The questions are: What is causing this?  Is this normal.  And the best part is, how to fix it.

At the moment, I had to do a quick fix, creating another swapfile round 256MB and add it to swap, so that a have longer time between recycling (sigh..).

Some info. (more if required)).

Disk Layout.
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0 -  242      180.35MB    (243/0/0)   369360
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup    wm       0 - 2732        1.98GB    (2733/0/0) 4154160
  3 unassigned    wm       0               0         (0/0/0)          0
  4        usr    wm     243 - 2386        1.55GB    (2144/0/0) 3258880
  5 unassigned    wm       0               0         (0/0/0)          0
  6       swap    wu    2387 - 2731      256.05MB    (345/0/0)   524400
  7 unassigned    wm       0               0         (0/0/0)          0

# showrev
Hostname: myserver
Hostid: somehostid
Release: 5.5.1
Kernel architecture: sun4u
Application architecture: sparc
Hardware provider: Sun_Microsystems
Domain: domain.com
Kernel version: SunOS 5.5.1 Generic 103640-27 March 1999


swap    -       /tmp    tmpfs   -       yes     -
/opt/swap/swap1 -       -       swap    -       no      -          

# swap -l
swapfile             dev  swaplo blocks   free
/dev/dsk/c0t0d0s6   32,6      16 524384 524384
/opt/swap/swap1       -       16 524272 524272      

Swapfile reading over time (10 seconds interval).

Filesystem            kbytes    used   avail capacity  Mounted on
swap                  695144       8  695136     1%    /tmp
swap                  695096       8  695088     1%    /tmp
swap                  695776       8  695768     1%    /tmp
swap                  691688       8  691680     1%    /tmp
swap                  693968       8  693960     1%    /tmp
swap                  696552       8  696544     1%    /tmp
swap                  699008       8  699000     1%    /tmp
swap                  698080       8  698072     1%    /tmp
swap                  700496       8  700488     1%    /tmp
swap                  698240       8  698232     1%    /tmp
swap                  699840       8  699832     1%    /tmp
swap                  698376       8  698368     1%    /tmp
swap                  701208       8  701200     1%    /tmp
swap                  701288       8  701280     1%    /tmp
swap                  700264       8  700256     1%    /tmp
swap                  698704       8  698696     1%    /tmp
swap                  697184       8  697176     1%    /tmp
swap                  695184       8  695176     1%    /tmp
swap                  686656       8  686648     1%    /tmp  

I would appreciate any help.

Unix OS

Avatar of undefined
Last Comment
Avatar of Asem
Flag of Germany image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of waltzer

If you need to identify the process which is causing the problem why not run
/usr/ucb/ps -aux
 periodically and redirect the output to a file. This should help you identify which processes are using up the memory. Look at the %MEM and SZ fields.
Hope this is useful.
Avatar of Asem
Flag of Germany image

But it can also be a file filling up /tmp which is written by a process, so also log file sizes within /tmp (and subdirs).
Avatar of samri
Flag of Malaysia image


Thanks all,

Basicall everybody's coment are good.   (How do I give points :?)

Anyway, I'm wandering if there is any site that I can visit to read more detail on this (perhaps any TID on Sun website).

And looking at my quick-fix (adding another swapfile) - is it the right way to get around, or anybody has a better recommendation.

thanks again. (i'll keep the question open for a  few more days)..

Avatar of blowfish
Flag of Canada image

The amount of swap space that you need depends on how much ram you have, and how much work you are trying to get done.  A general rule of thumb is to make swap = 2 X ram, but that is just a guess.  Solaris mounts /tmp on swap, and this is both a good thing and also a bad thing.  

As mentioned previously, the amount of available swap at any given time is egual to (total ram + total swap) - (total memory used by all processes + total size of all files stored on /tmp).  

Having /tmp mounted on swap is good because small temporary files will reside in memory on a lightly loaded machine, and accessing them will be very quick.  Having /tmp on swap is bad because uncompressing that 300MB webserver logfile in there chews up swap space that could be used to start new processes.  

Sometimes, in order to keep the box running while you try to discover what is filling swap up, allocating additional swap file(s) as you did will help see you through.  

One way to prevent large files in /tmp from consuming all of your swap space is to create a disk partition and mount /tmp on it.  In that case if /tmp fills up, you will still have swap space available to start new processes.  
You didn't mention what type of work this machine is doing, or how much ram is installed.  

Good luck, hope this helps,

Avatar of samri
Flag of Malaysia image


   Thanks for the elaborated explanation, some which I already knew, but most of them are quite informative I would say.
   As for you curiosity, the machine is a mailhub for a corporate network (16000+ users).  It's running Sendmail 8.9.3.  Haas apache, and mrtg running for internal monitoring.  And nothing else (except for the usual stuff that comes with Solaris 2.5.1).  

   The machine has 128MB Physical RAM, 256MB Swap partition (c0t3d0s6).  Single CPU, UltraSparc 167MHZ (i think).  We are on a 2Mbit link to our ISP.

   Initially it runs fine (for more than 2 years already), except it went down a couple of days ago.  Reason: /tmp full.  Quick fix, I added another 256MB swapfile -- and it looks okay for the last few days.

Any hints on performance improvement.

BTW, how do I spread the pts across the experts that contributed the quality comments (see Customer Service.. huh :)

Thanks again to all.

Avatar of darinw

Community Support has reduced points from 100 to 50
Avatar of darinw

Hello everyone,

Reducing points to one half to allow for split.

samri, you can now accept one of the comments in this thread as an answer. To award the other Expert, you can create a new question in this topic area with a title of 'For ExpertName -- 10441857' using that Experts username.

Remember, the Accept Comment as Answer button is in the header of the comment.

For your convenience, you can use this link to create the new question:

Customer Service
Avatar of samri
Flag of Malaysia image


Comment accepted as answer
Avatar of samri
Flag of Malaysia image


thanks to all.

Unix OS
Unix OS

Unix is a multitasking, multi-user computer operating system originally developed in 1969 at Bell Labs. Today, it is a modern OS with many commercial flavors and licensees, including FreeBSD, Hewlett-Packard’s UX, IBM AIX and Apple Mac OS-X. Apart from its command-line interface, most UNIX variations support the standardized X Window System for GUIs, with the exception of the Mac OS, which uses a proprietary system.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo