1833137 Members
3761 Online
110051 Solutions
New Discussion

Re: Erase Swap space

 
Dario_4
Frequent Advisor

Erase Swap space

Hi alls,

I wuold like to remove swap space. Actually my swap space is configured as:

/dev/vg00/lv_swap1 ... swap pri=1 0 0
/dev/vg00/lv_swap2 ... swap pri=1 0 0
/dev/vg00/lvol_swap ... swap defaults 0 0
/dev/vg00/lvol2 ... swap pri=1 0 0

I want remove it and put all swap space in /dev/vg00/lvol9, same as:


#swapinfo
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1048576 0 1048576 0% 0 - 1 /dev/vg00/lvol2
dev 8388608 0 8388608 0% 0 - 1 /dev/vg00/lvol9
reserve - 170852 -170852
memory 6473996 1668212 4805784 26%

How to do it ? Correct me if I wrong:

edit and comment the line related to swap in /etc/fstab.
Reboot the machie.
Create logical volume with swap.

Thanks a lot
4 REPLIES 4
Stefan Farrelly
Honored Contributor

Re: Erase Swap space


I think you mean remove all the swap areas apart from vg00/lvol2 as you cant remove this one ?

Anyway, easy enough. Create your new swap area, lvol9 to the size you want, add it to /etc/fstab, then run swapon -a to activate it.

Then to deactivate the old ones simply comment out their entries from /etc/fstab and reboot and youre done!
Im from Palmerston North, New Zealand, but somehow ended up in London...
U.SivaKumar_2
Honored Contributor

Re: Erase Swap space

Hi,
Steps to be followed
1) Edit /etc/fstab
2) comment old swap entries
3) leave this entry
/dev/vg00/lvol9 ... swap pri=1 0 0
4)Reboot the system

regards,
U.SivaKumar


Innovations are made when conventions are broken
Dario_4
Frequent Advisor

Re: Erase Swap space

I have two machines and I wuold like to put the swap space equal for both.

The firs one (miss one) give me this info:

Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1048576 0 1048576 0% 0 - 1 /dev/vg00/lvol2
dev 1048576 0 1048576 0% 0 - 1 /dev/vg00/lvol_swap
dev 3072000 0 3072000 0% 0 - 1 /dev/vg00/lv_swap1
dev 3072000 0 3072000 0% 0 - 1 /dev/vg00/lv_swap2
reserve - 167772 -167772
memory 6463800 149936 6313864 2%

Teh second one (correct one) is:

Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1048576 0 1048576 0% 0 - 1 /dev/vg00/lvol2
dev 8388608 0 8388608 0% 0 - 1 /dev/vg00/lvol9
reserve - 170852 -170852
memory 6473996 1668932 4805064 26%

How to put the first machine equal to the second one ?

Thanks a lot
Trond Haugen
Honored Contributor

Re: Erase Swap space

To remove the swap you will have to remove the lines from fstab and reboot. Swap can only be added without rebooting.
vg00/lvol2 is (usually) default swap and should not appear in fstab. But WILL be enabled (before fstab is read. Seeoutput of lvlnboot -v.)
Also remember that swap lvols have to be contiguous.

Regards,
Trond
Regards,
Trond Haugen
LinkedIn