Page 1 of 1

[solved] How to have swap space on automatically by default

Posted: Fri Sep 23, 2011 2:54 am
by lindsey
It used to be that swap space was automatically created and handled by Debian install, but since I started using LMDE, I found swap space was not created by default. So I had to create one by loggin in with live LMDE after the original installation was complete. Dismount the partition, resize to free up 2Gb for swap-space. I created a new primary partition in Gparted and assigned it as swap-space.

The problem is it is not automatically using this swap space every time I reboot I have to manually tell it to associate with the swap space. How do I get swap space to be used automatically, preferably without extensive modifications by commandline or obscure config files?

Re: How to have swap space on automatically by default

Posted: Fri Sep 23, 2011 3:37 am
by xenopeek
While I understand you want to do this without "commandline or obscure config files", I only know partially how to do this.

1. Do you already know the partition device name? (something like /dev/sda2) If not proceed to step 2, else skip to step 3.
2. To find the partition device name of your swap partition, start GParted from the menu. Look for a line that has "linux-swap" in the File System column, and note the name under Partition column. For example, see this screenshot, where it is the 4th line with partition device name /dev/sda2.
3. Press Alt+F2 to open the run dialog, or open a terminal, and enter the command:

Code: Select all

gksudo gedit /etc/fstab
At the end add the following line, replace the /dev/sda2 at the beginning with the partition device name of your swap partition:

Code: Select all

/dev/sda2       none            swap    sw              0       0
4. Save & close the file. Reboot to activate.

You can confirm swap is working by going to Control Center -> System Monitor, and clicking the Resources tab there. Below "Memory and Swap History" graph you can see the used swap and available swap.

Re: How to have swap space on automatically by default

Posted: Fri Sep 23, 2011 6:45 pm
by lindsey
Vincent Vermeulen wrote:While I understand you want to do this without "commandline or obscure config files", I only know partially how to do this.

1. Do you already know the partition device name? (something like /dev/sda2) If not proceed to step 2, else skip to step 3.
2. To find the partition device name of your swap partition, start GParted from the menu. Look for a line that has "linux-swap" in the File System column, and note the name under Partition column. For example, see this screenshot, where it is the 4th line with partition device name /dev/sda2.
3. Press Alt+F2 to open the run dialog, or open a terminal, and enter the command:

Code: Select all

gksudo gedit /etc/fstab
At the end add the following line, replace the /dev/sda2 at the beginning with the partition device name of your swap partition:

Code: Select all

/dev/sda2       none            swap    sw              0       0
4. Save & close the file. Reboot to activate.

You can confirm swap is working by going to Control Center -> System Monitor, and clicking the Resources tab there. Below "Memory and Swap History" graph you can see the used swap and available swap.
Thanks a mil Vincent! I will try your solution and report back when I get access to my machine in a couple of days time. Wish I could test it now, but it's in my locker at school. :P

Aside: From my last couple of posts, I guess the community/forum support for LMDE and Mint generally isn't too bad, thanks to keen members like yourself. :) That puts my worries to rest, as when I decided to convert from Ubuntu I thought the community support didn't compare.

(P.S. I tried to automatically have swap mounted in Gparted btw, but whilst it has an option to set swapon, there doesn't appear to be an option to have it on by default in Gparted. So I'll do it your way, but if anyone knows a way to do it it Gparted, it would be interesting to know too!)

Re: How to have swap space on automatically by default

Posted: Sun Sep 25, 2011 8:22 pm
by lindsey
It seems to work, thanks Vince! :)

Re: [solved] How to have swap space on automatically by defa

Posted: Mon Sep 26, 2011 2:37 am
by xenopeek
Thanks for the feedback on the solution :wink: Good that it works now :D