linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* a swap partition utilization question
@ 2003-11-25  6:09 Bill J.Xu
  2003-11-25 20:51 ` chuck gelm net
  0 siblings, 1 reply; 8+ messages in thread
From: Bill J.Xu @ 2003-11-25  6:09 UTC (permalink / raw)
  To: linux-admin

Hello everyone,

After booting my linux box,I add a swap partition using "swapon /dev/hda5".but I found that swap partition was nerver used even 2M physics memory left.

why?

thanks

Bill

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a swap partition utilization question
  2003-11-25  6:09 a swap partition utilization question Bill J.Xu
@ 2003-11-25 20:51 ` chuck gelm net
  2003-11-25 21:41   ` Darío Mariani
  2003-11-26  4:52   ` Bill J.Xu
  0 siblings, 2 replies; 8+ messages in thread
From: chuck gelm net @ 2003-11-25 20:51 UTC (permalink / raw)
  To: Bill J.Xu; +Cc: linux-admin

Hi, Bill:

 Perhaps swap memory will not be used until
all physical memory has been consumed.

HTH, Chuck

"Bill J.Xu" wrote:
> 
> Hello everyone,
> 
> After booting my linux box,I add a swap partition using "swapon /dev/hda5".but I found that swap partition was nerver used even 2M physics memory left.
> 
> why?
> 
> thanks
> 
> Bill
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a swap partition utilization question
  2003-11-25 20:51 ` chuck gelm net
@ 2003-11-25 21:41   ` Darío Mariani
  2003-11-25 21:46     ` Michael French
  2003-11-27  4:31     ` rich+ml
  2003-11-26  4:52   ` Bill J.Xu
  1 sibling, 2 replies; 8+ messages in thread
From: Darío Mariani @ 2003-11-25 21:41 UTC (permalink / raw)
  To: linux-admin

Try creating a program that consumes 90% or more of the physical memory.

chuck gelm net wrote:
> Hi, Bill:
> 
>  Perhaps swap memory will not be used until
> all physical memory has been consumed.
> 
> HTH, Chuck
> 
> "Bill J.Xu" wrote:
> 
>>Hello everyone,
>>
>>After booting my linux box,I add a swap partition using "swapon /dev/hda5".but I found that swap partition was nerver used even 2M physics memory left.
>>
>>why?
>>
>>thanks
>>
>>Bill
>>-
>>To unsubscribe from this list: send the line "unsubscribe linux-admin" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a swap partition utilization question
  2003-11-25 21:41   ` Darío Mariani
@ 2003-11-25 21:46     ` Michael French
  2003-11-27  4:31     ` rich+ml
  1 sibling, 0 replies; 8+ messages in thread
From: Michael French @ 2003-11-25 21:46 UTC (permalink / raw)
  To: linux-admin

    From a website I found:

http://www.netadmintools.com/art1.html
 by Urbana Der Ga'had

Sometimes in the course of a system's existence you find that the swap
partition you set up at install-time just isn't enough anymore. Maybe you're
upgrading your system to RedHat 7.1 from a version of RedHat that used less
swap in relation to physical RAM. Perhaps you're running Oracle. Or maybe
you're adding more memory and would like to increase swap space accordingly.


Our machine goblin is swapping like mad and we just can't take it down right
now to add more RAM. So to keep the machine from running out of memory
entirely and freezing, we'll add 128 MB more swap space by creating a swap
file.


First we check out the memory usage:


[root@goblin /root]# free -m
             total       used       free     shared    buffers     cached
Mem:           251        242          8         22         11         32
-/+ buffers/cache:        198         52
Swap:          133        133          0

Make sure we have 128 MB laying around somewhere:


[root@goblin /root]# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hda9               132207     33429     91952  27% /
/dev/hda1                15522      2537     12184  17% /boot
/dev/hda6              6143236    739000   5092176  13% /opt
/dev/hda7              1035660    836204    146848  85% /usr
/dev/hda5              2071384    344048   1622112  17% /usr/local
/dev/hda8               303344     14439    273244   5% /var
OK, we're going to make a swap file in /opt by using dd to create a file 128
MB in size.

[root@goblin /opt]# dd if=/dev/zero of=swapfile bs=1024 count=132207
132207+0 records in
132207+0 records out
[root@goblin /opt]# ls -l
total 132364
drwxr-xr-x   20 brenda users        4096 May 22 10:46 brenda
drwxr-xr-x    2 root     root        16384 Feb 21 07:04 lost+found
-rw-r--r--    1 root     root     135379968 May 29 11:52 swapfile
Hey, I know, let's not make it world-readable...

[root@goblin /opt]# chmod 600 swapfile
[root@goblin /opt]# ls -l
total 132364
drwxr-xr-x   20 brenda users        4096 May 22 10:46 brenda
drwxr-xr-x    2 root     root        16384 Feb 21 07:04 lost+found
-rw-------    1 root     root     135379968 May 29 11:52 swapfile
Now we set up the swap area and enable it.

[root@goblin /opt]# mkswap swapfile
Setting up swapspace version 1, size = 135372800 bytes
[root@goblin /opt]# swapon swapfile
And viola! Twice as much swap as before.

[root@goblin /opt]# free
total       used       free     shared    buffers     cached
Mem:        257632     254632       3000       2512      36172      15096
-/+ buffers/cache:     203364      54268
Swap:       268708     136512     132196
You can edit /etc/fstab to enable your swap file automatically at boot time.
By adding an entry like this:

/opt/swapfile swap swap defaults 0 0

Sure, swapping's ugly, slow and will grind your hard drives to dust. But
even modern systems which have been tuned for performance require a generous
oodle of swap space.


Michael French

----- Original Message ----- 
From: "Darío Mariani" <dmarian@fi.uba.ar>
To: <linux-admin@vger.kernel.org>
Sent: Tuesday, November 25, 2003 1:41 PM
Subject: Re: a swap partition utilization question


> Try creating a program that consumes 90% or more of the physical memory.
>
> chuck gelm net wrote:
> > Hi, Bill:
> >
> >  Perhaps swap memory will not be used until
> > all physical memory has been consumed.
> >
> > HTH, Chuck
> >
> > "Bill J.Xu" wrote:
> >
> >>Hello everyone,
> >>
> >>After booting my linux box,I add a swap partition using "swapon
/dev/hda5".but I found that swap partition was nerver used even 2M physics
memory left.
> >>
> >>why?
> >>
> >>thanks
> >>
> >>Bill
> >>-
> >>To unsubscribe from this list: send the line "unsubscribe linux-admin"
in
> >>the body of a message to majordomo@vger.kernel.org
> >>More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-admin"
in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a swap partition utilization question
  2003-11-25 20:51 ` chuck gelm net
  2003-11-25 21:41   ` Darío Mariani
@ 2003-11-26  4:52   ` Bill J.Xu
  2003-11-26 12:32     ` Glynn Clements
  1 sibling, 1 reply; 8+ messages in thread
From: Bill J.Xu @ 2003-11-26  4:52 UTC (permalink / raw)
  To: chuck gelm net; +Cc: linux-admin

Dear Chuck:

But I found that other linux box had used swap partition when many physical RAM left.

root@FW_knl:/home/shiy# free
             total       used       free     shared    buffers     cached
Mem:        255320     247564       7756          0      15652     197560
-/+ buffers/cache:      34352     220968
Swap:       996020       1484     994536
root@FW_knl:/home/shiy# 




Bill

----- Original Message ----- 
From: "chuck gelm net" <chuck@gelm.net>
To: "Bill J.Xu" <xujz@neusoft.com>
Cc: <linux-admin@vger.kernel.org>
Sent: Wednesday, November 26, 2003 4:51 AM
Subject: Re: a swap partition utilization question


> Hi, Bill:
> 
>  Perhaps swap memory will not be used until
> all physical memory has been consumed.
> 
> HTH, Chuck
> 
> "Bill J.Xu" wrote:
> > 
> > Hello everyone,
> > 
> > After booting my linux box,I add a swap partition using "swapon /dev/hda5".but I found that swap partition was nerver used even 2M physics memory left.
> > 
> > why?
> > 
> > thanks
> > 
> > Bill
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a swap partition utilization question
  2003-11-26  4:52   ` Bill J.Xu
@ 2003-11-26 12:32     ` Glynn Clements
  2003-11-26 13:02       ` Bill J.Xu
  0 siblings, 1 reply; 8+ messages in thread
From: Glynn Clements @ 2003-11-26 12:32 UTC (permalink / raw)
  To: Bill J.Xu; +Cc: chuck gelm net, linux-admin


Bill J.Xu wrote:

> > > After booting my linux box,I add a swap partition using "swapon
> > > /dev/hda5".but I found that swap partition was nerver used even
> > > 2M physics memory left.
> > > 
> > > why?
> > 
> >  Perhaps swap memory will not be used until
> > all physical memory has been consumed.
> 
> But I found that other linux box had used swap partition when many
> physical RAM left.
> 
> root@FW_knl:/home/shiy# free
>              total       used       free     shared    buffers     cached
> Mem:        255320     247564       7756          0      15652     197560
> -/+ buffers/cache:      34352     220968
> Swap:       996020       1484     994536
> root@FW_knl:/home/shiy# 

How long has the first box been up? And how intensive is memory demand
on that box?

Swap won't be used at all until physical memory becomes close to being
exhausted. However, after that point, even if more memory becomes
available, data won't be moved back into RAM unless it is actually
used.

There is often some data which will never be used again (e.g. memory
which is used by persistent daemons, but only during the
initialisation; the 6 getty processes running on tty1-tty6 which
typically never get used on a system which is running X, etc). Such
data is a strong candidate for being swapped out; once that happens,
it will typically never be swapped in again.

So, when a system is booted, there will always be a period when no
swap is used. If memory demand is low, that period may last
indefinitely. OTOH, once memory demand has been sufficiently high to
have required the use of swap, swap usage will probably never drop
back to zero.

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a swap partition utilization question
  2003-11-26 12:32     ` Glynn Clements
@ 2003-11-26 13:02       ` Bill J.Xu
  0 siblings, 0 replies; 8+ messages in thread
From: Bill J.Xu @ 2003-11-26 13:02 UTC (permalink / raw)
  To: Glynn Clements; +Cc: chuck gelm net, linux-admin

Hi, Clements:

Thank you for your detailed explains first.

I use the linux box as a firewall, so it is highly loaded at any time.At most time, it's available physical RAM is less 2M, but SWAP partition is never used. This 
make me confused.



Bill


----- Original Message ----- 
From: "Glynn Clements" <glynn.clements@virgin.net>
To: "Bill J.Xu" <xujz@neusoft.com>
Cc: "chuck gelm net" <chuck@gelm.net>; <linux-admin@vger.kernel.org>
Sent: Wednesday, November 26, 2003 8:32 PM
Subject: Re: a swap partition utilization question


> 
> Bill J.Xu wrote:
> 
> > > > After booting my linux box,I add a swap partition using "swapon
> > > > /dev/hda5".but I found that swap partition was nerver used even
> > > > 2M physics memory left.
> > > > 
> > > > why?
> > > 
> > >  Perhaps swap memory will not be used until
> > > all physical memory has been consumed.
> > 
> > But I found that other linux box had used swap partition when many
> > physical RAM left.
> > 
> > root@FW_knl:/home/shiy# free
> >              total       used       free     shared    buffers     cached
> > Mem:        255320     247564       7756          0      15652     197560
> > -/+ buffers/cache:      34352     220968
> > Swap:       996020       1484     994536
> > root@FW_knl:/home/shiy# 
> 
> How long has the first box been up? And how intensive is memory demand
> on that box?
> 
> Swap won't be used at all until physical memory becomes close to being
> exhausted. However, after that point, even if more memory becomes
> available, data won't be moved back into RAM unless it is actually
> used.
> 
> There is often some data which will never be used again (e.g. memory
> which is used by persistent daemons, but only during the
> initialisation; the 6 getty processes running on tty1-tty6 which
> typically never get used on a system which is running X, etc). Such
> data is a strong candidate for being swapped out; once that happens,
> it will typically never be swapped in again.
> 
> So, when a system is booted, there will always be a period when no
> swap is used. If memory demand is low, that period may last
> indefinitely. OTOH, once memory demand has been sufficiently high to
> have required the use of swap, swap usage will probably never drop
> back to zero.
> 
> -- 
> Glynn Clements <glynn.clements@virgin.net>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: a swap partition utilization question
  2003-11-25 21:41   ` Darío Mariani
  2003-11-25 21:46     ` Michael French
@ 2003-11-27  4:31     ` rich+ml
  1 sibling, 0 replies; 8+ messages in thread
From: rich+ml @ 2003-11-27  4:31 UTC (permalink / raw)
  To: Darío Mariani; +Cc: linux-admin

perl -e '$x="x"x(.9*2*2**30)'

On Tue, 25 Nov 2003, Darío Mariani wrote:

> Date: Tue, 25 Nov 2003 18:41:11 -0300
> From: Darío Mariani <dmarian@fi.uba.ar>
> To: linux-admin@vger.kernel.org
> Subject: Re: a swap partition utilization question
> 
> Try creating a program that consumes 90% or more of the physical memory.
> 
> chuck gelm net wrote:
> > Hi, Bill:
> > 
> >  Perhaps swap memory will not be used until
> > all physical memory has been consumed.
> > 
> > HTH, Chuck
> > 
> > "Bill J.Xu" wrote:
> > 
> >>Hello everyone,
> >>
> >>After booting my linux box,I add a swap partition using "swapon /dev/hda5".but I found that swap partition was nerver used even 2M physics memory left.
> >>
> >>why?
> >>
> >>thanks
> >>
> >>Bill
> >>-
> >>To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> >>the body of a message to majordomo@vger.kernel.org
> >>More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> > 
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-11-27  4:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-25  6:09 a swap partition utilization question Bill J.Xu
2003-11-25 20:51 ` chuck gelm net
2003-11-25 21:41   ` Darío Mariani
2003-11-25 21:46     ` Michael French
2003-11-27  4:31     ` rich+ml
2003-11-26  4:52   ` Bill J.Xu
2003-11-26 12:32     ` Glynn Clements
2003-11-26 13:02       ` Bill J.Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).