Page 1 of 1

[Solved] How to remove swap?

Posted: Thu Feb 16, 2012 9:04 pm
by Lumikki
I noticed that my Mint 12 Cinnamon never use swap at all. So, I was thinking to remove it.

If I do this:

swapoff -a
Then comment swap disk off from fstab.

Is that all whats required?

Re: How to remove swap?

Posted: Fri Feb 17, 2012 1:34 am
by claudecat
You could go a step further and delete your swap partition using gparted. My swap never gets used either, but with disk space so cheap (I have over 4tb), I leave it as it is.

Re: How to remove swap?

Posted: Fri Feb 17, 2012 8:43 am
by sdim
Yeah, but won't he have to adjust some things in fstab, then?
I've read that one needs to do that, so I didn't bother deleting my Swap unused space.

Re: How to remove swap?

Posted: Fri Feb 17, 2012 9:27 am
by Rua
But what happens if you run out of memory? Even if it just happens once... you never know.

Re: How to remove swap?

Posted: Fri Feb 17, 2012 1:06 pm
by Lumikki
If computer runs out of memory, then it's crash. I assume.
Okey, I got my swap removed. What wasn't that big job.

Re: How to remove swap?

Posted: Fri Feb 17, 2012 2:10 pm
by mikecrosoft
Hello lumikki. I think there is really no problem with letting your system use some swap space, but if you really need to decrease the priority of Virtual Memory vs RAM usage you can simply change the swappiness value; to do that it would be as follows (extracted from https://help.ubuntu.com/community/SwapFaq, and tested so many times in the past and once while writing the comment):

** This would be just in case yu haven't deleted your swap partition or permanently modified anything related, I've read you have already deleted your swap partition so I post this just in case somebody needs a less agressive approach **

1. Open a terminal
2. Type:

Code: Select all

cat /proc/sys/vm/swappiness
3. That will display your swappiness actual value (60)
4. If you are going to be testing your system performance during some time to see if you really need to make this change permanent or if you're going to try with different swappiness values until you find the optimum one, I suggest you to create a launcher in your desktop with the following command:

Code: Select all

gksudo sysctl vm.swappiness=10
5. That will change your swappiness value to 10 when you double click the launcher, to try with different values just replace 10 by any integer number in the range 0-100
6. Once you have find the optimum value and decided to make changes permanent, open a terminal and type:

Code: Select all

sudo gedit /etc/sysctl.conf
7. Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:

Code: Select all

vm.swappiness=10
8. Save the file, reboot and check the change is workig using the command in step 2