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

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
lindsey
Level 1
Level 1
Posts: 24
Joined: Tue Sep 20, 2011 1:53 am

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

Post 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?
Last edited by lindsey on Sun Sep 25, 2011 8:22 pm, edited 1 time in total.

User avatar
xenopeek
Level 24
Level 24
Posts: 24281
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: How to have swap space on automatically by default

Post 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.
Image

lindsey
Level 1
Level 1
Posts: 24
Joined: Tue Sep 20, 2011 1:53 am

Re: How to have swap space on automatically by default

Post 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!)

lindsey
Level 1
Level 1
Posts: 24
Joined: Tue Sep 20, 2011 1:53 am

Re: How to have swap space on automatically by default

Post by lindsey »

It seems to work, thanks Vince! :)

User avatar
xenopeek
Level 24
Level 24
Posts: 24281
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

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

Post by xenopeek »

Thanks for the feedback on the solution :wink: Good that it works now :D
Image

Post Reply

Return to “Installation & Boot”