SUMMARY: Am I swapping as planned?

From: Steve Campbell (steve@avalon.dartmouth.edu)
Date: Tue Sep 03 1991 - 21:40:28 CDT


I recently asked how I could tell if my Sun 4/280 running 4.1 was
swapping as I thought it should. I gave some reasons why I suspected
it was not, including the fact that swapon was silent at boottime. I
included some pertinent documents such as this line from my config file:

  config vmunix root on xy0 swap on xy0 swap on xy1

and this line from my /etc/fstab:

  /dev/xy1b swap swap rw 0 0

I asked these questions:

         1. Shouldn't swapon report what it's doing?
         2. How can I determine where a running system is swapping?
         3. Is there an error in this configuration?

I received about 20 replies, for which I am very grateful. No one
knows of a way to determine directly which swap disks are actually in
use, but almost everyone suggested using pstat(8) to find out
indirectly. For example, here is the advice of Jay Plett
(jay@Princeton.EDU):

        Use "pstat -T" to see how much total swap space you have.
                rebus# pstat -T
                244/582 files
                369/369 inodes
                 48/138 processes
                9620/33692 swap
        The numbers for swap are kbytes; this is showing 9620k in
        use, with a total of 33692 kbytes available. Comparing this
        number with the partition sizes reported by "dkinfo xy0b" and
        "dkinfo xy1b" (reported in sectors of .5 kbytes) will tell
        you which partitions are being used.

Doing this showed me that, sure enough, I was only swapping on one disk.

This was also confirmed by inspecting the file confvmunix.c in the
directory where my kernel is compiled. It showed a swap entry only for
xy1b. The reason is that contrary to the Sun documentation only one
swap phrase should appear on the config line. Config does not complain
if there are more, but it will silently ignore all but the last. So I
had in effect configured my kernel to swap only on xy1. When swapon
ran, the system was already swapping on xy1, so swapon had nothing to
do and said nothing.

The quick fix was to run swapon manually, telling it to swap on xy0.
The real fix is to adopt a more conventional configuration, namely to
configure the kernel to swap initially on xy0 and then have swapon add
xy1. Thus the config file contains:

  config vmunix root on xy0 swap on xy0

and /etc/fstab (still) contains:

  /dev/xy1b swap swap rw 0 0

Many thanks to all who responded. As usual, I got timely good advice.

                                                Steve Campbell



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:19 CDT