1830410 Members
2362 Online
110002 Solutions
New Discussion

Removing swap

 
SOLVED
Go to solution
Mike_305
Super Advisor

Removing swap

Hi,

I have on my system two swap space configured on two different disk and I want to remove one of the swap space. I know I can use sam to do this or do lvreduce. Is their any way I can prevent data loss. What I am trying to find out, is their a right way to do this?

Thanks for your help.

Mike
If there is problem then don't think as problem, think as opportunity.
10 REPLIES 10
S.K. Chan
Honored Contributor
Solution

Re: Removing swap

It is not possible to remove swap online. You must deactivate the swap you want to remove and reboot by using these steps :-
a) Comment out the line for the swap area in /etc/fstab.
b) Reboot the machine.
c) The swap lvol is now not activated anymore and you can remove it with lvremove command.
Ex:
# lvremove /dev/vg01/lvol2
James R. Ferguson
Acclaimed Contributor

Re: Removing swap

Hi Mike:

The key to removing a swap device is that you must reboot. Delete the swap entry (that you want to negate) from '/etc/fstab'. Next, reboot. Lastly, 'lvremove' the device swap.

Regards!

...JRF...
Helen French
Honored Contributor

Re: Removing swap

Hi Mike:

It is not possible to remove swap online. You must deactivate the swap you want to remove and reboot by using these steps:

1. Comment out the line for the swap area in /etc/fstab.

2. Reboot.

3. The swap lvol is not activated anymore, so you can remove it with lvremove.

HTH,
Shiju


Life is a promise, fulfill it!
Craig Rants
Honored Contributor

Re: Removing swap

The easy answer is to delete the entry refering to the lvol in your fstab and then reboot your box.

If your more comfortable with sam use that.

GL,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
MANOJ SRIVASTAVA
Honored Contributor

Re: Removing swap

Hi Mike

You cannot remiove secondary swap online. You need to disable it or commnet the entry in /etc/fstab , then reboot the machine and the reclaim the volume .

Manoj Srivastava
Mike_305
Super Advisor

Re: Removing swap

Hi,

What about my "maxswapchunck" entry in kernel. Do I need to reduce that?

Thanks,

Mike
If there is problem then don't think as problem, think as opportunity.
S.K. Chan
Honored Contributor

Re: Removing swap

Short answer is NO. The maxswapchunk only needs to be increase to allow you to configure more swap space. Reducing your swap space later does not necessarily means you got to reduce the parameter. If you reduce it, later when you decided to add back the swap, you'll then have to incerease maxswapchunk. Too troublesome ..
Wodisch
Honored Contributor

Re: Removing swap

Hi Mike,

no, you would not even want to reduce it:
Imagine at some point in the future the needs for more swap space might occur. Then you can add more swap space again *online* (without reboot, or the need to stop the application)!

Regards,
Wodisch
Helen French
Honored Contributor

Re: Removing swap

Mike:

NO. You can leave it like that. There is no need to do this.

HTH,
Shiju
Life is a promise, fulfill it!
Mike_305
Super Advisor

Re: Removing swap

Hi Guys,

Thanks, I will assign points. It's a party time, every one gets 10 points for quick reply.

Thanks,

Mike

If there is problem then don't think as problem, think as opportunity.