Re: Not using Swap?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



P <xflys@carolina.net> writes:

> On Friday 30 August 2002 07:42 pm, Timothy Writer wrote:
> > Matt Fahrner <Matt.Fahrner@coat.com> writes:
> > > Does anyone know why a Linux box that is low on memory would choose to
> > > not use swap? We have a couple of RedHat linux boxes that seem to choose
> > > to run out of memory before they'll use swap. They aren't even using the
> > > same kernel.
> > >
> > >
> > > As an example, one of the boxes is RedHat 7.1 running a stock
> > > "2.4.9-21smp" kernel. It's swap partition is:
> > >
> > >
> > >     Filename 	Type		Size	Used	Priority
> > >     /dev/sda10      partition	1036152	4	-1
> >
> > According to "man swapon", priority is a value between 0 and 32767.  I
> > suspect -1 means the swap area isn't being used.  Did you mkswap(8) on it?
> 
> It's interesting that I have the same observation on rh 7.3 ... whenever I've 
> observed my swap activity, it's always zero.

Here's a RH 7.3 system with three swap areas:

    Filename                        Type            Size    Used    Priority
    /dev/hda2                       partition       1048816 0       10
    /dev/hdc2                       partition       1048816 0       10
    /dev/sda2                       partition       1052216 65036   20

And in /etc/fstab, I have:

    /dev/hda2       swap                    swap    pri=10          0 0
    /dev/hdc2       swap                    swap    pri=10          0 0
    /dev/sda2       swap                    swap    pri=20          0 0

> But, your question about executing "mkswap" implies that the user is
> supposed to do this ... I don't understand that, since the swap is set up
> during installation, and supposedly the boot script enables it every time
> you start.

Right.  The installation _should_ run mkswap on any partitions you configured
as swap and add them to /etc/fstab with entries similar to those above.  The
boot scripts run "swapon -a" which enables every swap partition listed in
/etc/fstab.

> Why is it necessary for a user to do "mkswap" and or "swapon" if the
> installation went ok?

Normally, it's not.  But it's possible something went wrong during the
installation.  There's no harm in doing it yourself.  Try the following
(as root):

    # swapoff -a
    # mkswap /dev/sda10

    Now edit /etc/fstab to check and correct the swap entry
    for /dev/sda10

    # swapon -a

Hopefully, this will solve your problem.

-- 
tim writer <tim@starnix.com>                                  starnix inc.
tollfree: 1-87-pro-linux                        thornhill, ontario, canada
http://www.starnix.com              professional linux services & products



_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@redhat.com
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux