[Solved] How to remove swap?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
User avatar
Lumikki
Level 4
Level 4
Posts: 232
Joined: Wed Feb 01, 2012 5:21 pm

[Solved] How to remove swap?

Post by Lumikki » Thu Feb 16, 2012 9:04 pm

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?
Last edited by Lumikki on Fri Feb 17, 2012 6:21 pm, edited 1 time in total.
Asus P7P55D, i5 750 2.6Ghz, 4GB DDR3, GeForce 750Ti, 80GB Intel SSD, Dell 1600x1200, Dual boot, Linux Mint 18 Cinnamon, Windows 7

claudecat
Level 3
Level 3
Posts: 115
Joined: Wed Mar 03, 2010 1:03 am
Location: MD, USA

Re: How to remove swap?

Post by claudecat » Fri Feb 17, 2012 1:34 am

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.

User avatar
sdim
Level 3
Level 3
Posts: 150
Joined: Fri Mar 21, 2008 6:19 pm

Re: How to remove swap?

Post by sdim » Fri Feb 17, 2012 8:43 am

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.
MB:MSI 770 C-45 / HD1:500 GB-->Windows / HD2:320 GB-->Mint 18 Cinnamon
CPU:AMD X4 640 3.00 GHz / RAM:4.0 GB / VGA: NVidia GeForce GT630

Rua
Level 3
Level 3
Posts: 153
Joined: Sat Sep 17, 2011 11:09 am
Location: Netherlands

Re: How to remove swap?

Post by Rua » Fri Feb 17, 2012 9:27 am

But what happens if you run out of memory? Even if it just happens once... you never know.

User avatar
Lumikki
Level 4
Level 4
Posts: 232
Joined: Wed Feb 01, 2012 5:21 pm

Re: How to remove swap?

Post by Lumikki » Fri Feb 17, 2012 1:06 pm

If computer runs out of memory, then it's crash. I assume.
Okey, I got my swap removed. What wasn't that big job.
Asus P7P55D, i5 750 2.6Ghz, 4GB DDR3, GeForce 750Ti, 80GB Intel SSD, Dell 1600x1200, Dual boot, Linux Mint 18 Cinnamon, Windows 7

User avatar
mikecrosoft
Level 3
Level 3
Posts: 133
Joined: Thu Jan 19, 2012 6:20 pm

Re: How to remove swap?

Post by mikecrosoft » Fri Feb 17, 2012 2:10 pm

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

Post Reply

Return to “Newbie Questions”