Adding swap space using 'swap -a' command ?

Adding swap space using 'swap -a' command ?

Post by Eric Chi » Sat, 30 May 1998 04:00:00



Greetings,

I am using SCO OpenServer 5.0.4 on a compaq prolian 4500 server. The
initial swap space setup is too small. I want to increase the swap
space.

I first create a directory say '/hotswap' and inside the hotswap
directory, I created a empty file called 'swapfile2'. I then make the
file swapfile2 act as a swap space
using :
              swap -a /hotswap/swapfile2 65536

When I used 'swap -l' to list the current swap space, it appears to have
added to the system. But when I check the system disk space, it appear
to be the same as before the swap file is added to the system.

path                                        swaplo    block        free
block
=========================================
/dev/swap                  1,41            0        196668      186790
/hotswap/swapfile2     76,1            0        65536        65536

Can someone tell if I done it correctly?  If not, how should I do it ?


Thank in advance

Eric Chin

 
 
 

Adding swap space using 'swap -a' command ?

Post by Mike Hopkirk (ho » Sun, 31 May 1998 04:00:00



>I am using SCO OpenServer 5.0.4 on a compaq prolian 4500 server. The
>initial swap space setup is too small. I want to increase the swap
>space.

>I first create a directory say '/hotswap' and inside the hotswap
>directory, I created a empty file called 'swapfile2'. I then make the
>file swapfile2 act as a swap space
>using :
>              swap -a /hotswap/swapfile2 65536

>When I used 'swap -l' to list the current swap space, it appears to have
>added to the system. But when I check the system disk space, it appear
>to be the same as before the swap file is added to the system.

>path                                        swaplo    block        free
>block
>=========================================
>/dev/swap                  1,41            0        196668      186790
>/hotswap/swapfile2     76,1            0        65536        65536

This is telling you its not swapped anything into the swapfile yet
( free == blocks)

If you look at the actual file length in the fs is probably still
0 length...

It'll grow as it needs to use the swap space on that file...

I presume you could preallocate that space in that file by
using dd to make a file of the max swap size specified (once) before you
use swap -a to add it ..
--
- hops

Everything disclaimed (including disclaimer)

Mike Hopkirk ( hops )  |       Whenever possible steal code.
SCO Inc                |          Tom Duff. Bell Labs

 
 
 

Adding swap space using 'swap -a' command ?

Post by Bela Lubki » Sun, 31 May 1998 04:00:00



> I am using SCO OpenServer 5.0.4 on a compaq prolian 4500 server. The
> initial swap space setup is too small. I want to increase the swap
> space.

> I first create a directory say '/hotswap' and inside the hotswap
> directory, I created a empty file called 'swapfile2'. I then make the
> file swapfile2 act as a swap space
> using :
>               swap -a /hotswap/swapfile2 65536

> When I used 'swap -l' to list the current swap space, it appears to have
> added to the system. But when I check the system disk space, it appear
> to be the same as before the swap file is added to the system.

> path                                        swaplo    block        free
> block
> =========================================
> /dev/swap                  1,41            0        196668      186790
> /hotswap/swapfile2     76,1            0        65536        65536

> Can someone tell if I done it correctly?  If not, how should I do it ?

Well, it's up to you.  You can fully allocate the swapfile when you
create it, in which case that disk space is consumed.  Or you can leave
it empty, and then if the swap space is ever used, disk blocks will be
allocated.  To fully pre-allocate the space, just copy something into
the file, e.g.:

  dd if=/dev/zero bs=1024k count=32 of=/hotswap/swapfile2

(BTW, swap(ADM) uses 512-byte blocks, so your 65536 blocks == 32MB.)

- Show quoted text -

Quote:>Bela<

 
 
 

1. swap space descrepancy between top and 'swap'

Hello, Solaris gurus,

We have a problem on several Solaris 9 boxes where our web servers keep
failing with fork errors (out of memory). Using 'top' shows that the swap
space is indeed full, and thus the error is expected. Other tools, e.g.,
'swap' and 'df /tmp' show the swap space as being 90+% free/unused.

Can someone please clue me in on an accurate way to get the amount of swap
space available to the box? Adding swap files with 'swap -a file' does
indeed add more swap space, but top shows it being immediately (and
completely) as used, whereas swap/df show it as free swap space. (IMO it's
simply not possible that 3GB of swap space can be used up in under 2
seconds, but i'm not Solaris expert.)

In case it matters, this happens very often when our web servers (Apache
1.3.28) get traffic spikes (150-200 users). The servers do not show any
other odd behaviour or heavy load, except for the quasi-bogus
out-of-swap-space which leads to all sorts of other problems. The servers
have ample RAM and drive space and only run apache, so these errors are
particularly annoying. :/

Any tips would be greatly appreciated.

--
----- stephan beal
http://s11n.net/
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.

2. X11 R5/R6 Shared libraries.

3. Allocated swap space versus used swap space

4. Procmail no longer working

5. Determining process swap space/mem utilization with 'ps' and 'pstat' listings

6. mgetty initializes modem then exits???

7. Q: Why CAN'T add swap space

8. Redirecting all traffic through a script?

9. Adding Swap: 257000k swap-space (priority -1)

10. what's using my swap space up?

11. Linux isn't using swap space

12. Swap space used when it shouldn't be