SUMMARY: How to add more swap space?

From: Zu, Hongya <Zuh_at_pediatrics.ohio-state.edu>
Date: Fri, 14 Jan 2000 12:07:19 -0500

Original Question:
Hi everyone:
I got the following message:"swap space below 10 percent free" when I run
some program.
I checked the swap with command:
# swapon -s
                swap space below 10 percent free
                Swap partition /dev/re0b (default swap):
                                Allocated space: 98304 pages (768MB)
                                In-use space: 4302 pages ( 4%)
                                Free space: 94002 pages ( 95%)
                Total swap allocation:
                                Allocated space: 98304 pages (768MB)
                                Reserved space: 88516 pages ( 90%)
                                In-use space: 4302 pages ( 4%)
                                Available space: 9788 pages ( 9%)
Please tell me the detail how to make the swap space bigger.
Thanks lot!

Answers:
Hi Hongya,

Looking at the output of swapon -s, suggests to me that you may not want to
increase your swap partition, but change the way that swap is used.

Check for the file /sbin/swapdefault

If it exists, it will be a link to your swap partition. This means that
your running swap in immediate mode, not deferred.

Immediate allocates swap to processes, without utilising it. Deferred only
uses swap when it needs it.

If your system does not use up all available memory then it is a good idea
to run in deferred mode. You just need to be careful here if you do start
to use swap, that it does not use all of it, as the system will then start
to kill off processes if both all of your swap and memory is used.

To use deferred mode remove this link with the rm command. Re-boot the
machine after having done this.

To use immediate mode recreate the link,

ln -s /dev/rz? /sbin/swapdefault

Then re-boot.

As to your original question.

You can add more swap in two ways.

Without having to re-boot.

If you have any spare disk partitions, you can use disklabel to create a
swap partition, then add that swap with the command

swapon /dev/rz?

wher /dev/rz? is the device that you wish to use as swap.

If you intend to use this permanently, the remember to add a line referring
to it in to the /etc/fstab file, with syntax similar to the following:-

/dev/rz? swap2 ufs sw 0 2

The second way requires booting to single use mode, and if you've enough
space free, which is contigious with your existing swap, /dev/re0b, then you
can use disklabel to increase the size of the partition. No further work
would be necessary. You cannot alter the size of the partition while it is
in use though. I can't remember, but you may have to remove the link to
/sbin/swapdefault if it exists, and any entries in the fstab file. This
will ensure you boot a machine which is not using any swap. You will then
be able to play around with the size of the partition.


hope this helps you

regards


Mark

=========================================================
Thanks to:
Mark Charlton [m.j.charlton_at_qmw.ac.uk]
simon.millard_at_barclays.co.uk
zbigniew.kadziela_at_plsig.mail.abb.com
carlos.chua_at_asia.paribas.com
Degerness, Mandell ISTA:EX [Mandell.Degerness_at_gems2.gov.bc.ca]
alan.c.davis_at_worldnet.att.net
Larye D. Parkins [larye_at_selway.umt.edu]
Freesmeyer, Mary [Mary.Freesmeyer_at_LendersService.com]
alan_at_nabeth.cxo.dec.com
Balaji Chandrasekar [balaji_at_astro.ocis.temple.edu]
Cledson Souza [cledson_at_castelobranco.br]
Joe Fletcher [joe_at_meng.ucl.ac.uk]
Luchini, Marco [Marco.Luchini_at_acco-uk.co.uk]
Dr. Tom Blinn, 603-884-0646 [tpb_at_doctor.zk3.dec.com]
Dave Sill [de5_at_sws5.ctd.ornl.gov]
============================================================



++++++++++++++++++++++++++++++++++++++++++
Hongya Zu
Research Information Service
Children's Research Institute
700 Children's Drive
Columbus, OH 43205
Phone: (614) 722-2914
Fax: (614) 722-2716
Email: zuh_at_pediatrics.ohio-state.edu
+++++++++++++++++++++++++++++++++++++++++
Received on Fri Jan 14 2000 - 17:13:35 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:40 NZDT