1755067 Members
3541 Online
108829 Solutions
New Discussion юеВ

Decrease size of swap?

 
SOLVED
Go to solution
Jane Lecian
Valued Contributor

Decrease size of swap?

We have a 11.0 system with 2 GB RAM. I have been monitoring the swap usage for a couple weeks now using swapinfo in a script. It currently has 6 GB of primary swap, and no secondary swap. The percentage used never varies from 5%, and the system has been getting a really good workout this past week.

Could I decrease the size of swap without impacting performance, and reuse the space on another volume? I am thinking of decreasing swap to 4 GB. The system is running really well right now, and I would hate to do anything that would impact performance.

Thanks,

Jane
5 REPLIES 5
Stefan Farrelly
Honored Contributor
Solution

Re: Decrease size of swap?

You certainly can reduce your swap size. It really needs to be only the same size as RAM.

It all depends on how your swap is configured as to how easy to remove. If you have > 1 lvol with swap on then comment them out of /etc/fstab, reboot and your done.
If you have only 1 large swap lvol (unlikely) then you will need to use an ignite make_recovery image to downsize it (which involves a fair bit of work).
Im from Palmerston North, New Zealand, but somehow ended up in London...
Patrick Wallek
Honored Contributor

Re: Decrease size of swap?

Is your 6GB of swap /dev/vg00/lvol2? If so, you are going to have a hard time reducing it without makeing a make_tape_recovery tape, booting from it, and resizing your primary swap LV.

Unless you are really desparate for space in vg00, I probably wouldn't worry about it.
A. Clay Stephenson
Acclaimed Contributor

Re: Decrease size of swap?

Hi Jane:

In your case absolutely. You appear to have followed the very old rule of 2-3x memory for swapspace. This rule very seldom aplies to modern boxes and you could very easily the amount of swap you have. In fact, you seem to be using so little swap that ifg you need the disk, I would reduce to well under the amount of memory (~ 512MB-1024MB) and use filesystem swap space at very low priority. The filesystem swap will never be used but it does serve as a safety net.
If it ain't broke, I can fix that.
Jane Lecian
Valued Contributor

Re: Decrease size of swap?

The swap space is all configured as /dev/vg00/lvol2. I am not really desparate for the space so I think I will just leave it alone for now.

Thanks for the info., and the warning. It is really nice to have the heads up, and to save myself a lot of work for now. Also it helps in planning for future maintenance.

Jane
John Palmer
Honored Contributor

Re: Decrease size of swap?

Hi Jane,

If your current swap is a single 6Gb logical volume then your easiest option is to recreate the root volume - ignite is probably your best option. Your alternative is to boot your server from another disk in order to resize the current volume.

If however, you have more than one swap volume then you can remove any or all of them (apart from the primary) by removing their entries from /etc/fstab and rebooting. You can't remove primary swap because it's always in use.

After the reboot, you can simply remove the volumes with lvremove.

Regards,
John