Enabling swap on LMDE (Solved)

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 this

Enabling swap on LMDE (Solved)

Postby AlanWalker on Mon May 05, 2014 7:05 pm

When I installed LMDE I pre-partitioned my system's HD; this is how it looks.

When I installed LMDE I thought that Linux would recognize the swap partition, and use it; but now I see that that isn't so.

That fact leads me to ask 'How does one enable LMDE's use of a swap partition when that partition is alread defined?'

TIA
Last edited by AlanWalker on Mon May 05, 2014 9:47 pm, edited 1 time in total.
User avatar
AlanWalker
Level 4
Level 4
 
Posts: 223
Joined: Wed Jun 12, 2013 7:44 pm
Location: New York

Linux Mint is funded by ads and donations.
 

Re: Enabling swap on LMDE

Postby kyphi on Mon May 05, 2014 7:36 pm

When I installed LMDE I thought that Linux would recognize the swap partition, and use it; but now I see that that isn't so.
How so?
According to the image you posted the swap partition is recognised as shown in gparted.

You can also use
Code: Select all
inxi -plu
in a terminal to see your swap partition.
User avatar
kyphi
Level 5
Level 5
 
Posts: 857
Joined: Sat Jul 09, 2011 1:14 am
Location: Australia

Re: Enabling swap on LMDE

Postby AlanWalker on Mon May 05, 2014 7:43 pm

kyphi wrote:
When I installed LMDE I thought that Linux would recognize the swap partition, and use it; but now I see that that isn't so.
How so?
According to the image you posted the swap partition is recognised as shown in gparted.

You can also use
Code: Select all
inxi -plu
in a terminal to see your swap partition.

To answer your question, I used gparted on a live CD. I formatted sda2 as swap when I did so; I now believe doing so unintentionally masks the situation.

Output of inxi -plu:

alan@lmde1 ~ $ inxi -plu
Partition: ID: / size: 58G used: 16G (28%) fs: ext3 dev: /dev/sda1
label: N/A uuid: cb82582b-c476-49f2-baa6-89b9b99e4894
ID: /home size: 168G used: 16G (10%) fs: ext3 dev: /dev/sda3

As it may help, this is how how my /etc/fstab looks.
Last edited by AlanWalker on Mon May 05, 2014 8:26 pm, edited 2 times in total.
User avatar
AlanWalker
Level 4
Level 4
 
Posts: 223
Joined: Wed Jun 12, 2013 7:44 pm
Location: New York

Re: Enabling swap on LMDE

Postby kyphi on Mon May 05, 2014 7:57 pm

I see what you mean. Using inxi -l this is what I have (our partitioning looks similar except for swap):

Partition: ID: / size: 12G used: 5.0G (45%) fs: ext4 dev: /dev/sda1 label: N/A
ID: /home size: 95G used: 37G (41%) fs: ext4 dev: /dev/sda3 label: N/A
ID: swap-1 size: 4.29GB used: 0.00GB (0%) fs: swap dev: /dev/sda2 label: N/A
User avatar
kyphi
Level 5
Level 5
 
Posts: 857
Joined: Sat Jul 09, 2011 1:14 am
Location: Australia

Re: Enabling swap on LMDE

Postby kyphi on Mon May 05, 2014 8:02 pm

This should have been sorted out during installation regardless of what you did with the live DVD.

http://www.cyberciti.biz/faq/linux-add- ... ile-howto/
User avatar
kyphi
Level 5
Level 5
 
Posts: 857
Joined: Sat Jul 09, 2011 1:14 am
Location: Australia

Re: Enabling swap on LMDE

Postby AlanWalker on Mon May 05, 2014 8:43 pm

kyphi wrote:This should have been sorted out during installation regardless of what you did with the live DVD.

http://www.cyberciti.biz/faq/linux-add- ... ile-howto/

As it happens I had previously looked at the page you cite while
researching this problem. I moved on as the instructions were for
creating a swap file in "/". As you cited that page I decided to take
a closer look and try altering commands to work with a swapfile
on sda2.

Following on your cite (with alters to suit my system) I prepared
the following list of commands to setup my system to use swap:

1. dd if=/dev/zero of=/sda2/swapfile
2. mkswap /sda2/swapfile
3. chown root:root /sda2/swapfile
4. chmod 0600 /sda2/swapfile
5. swapon /sda2/swapfile

Command in Line 1. above is intended to create and zero out a file on
sda2 instead of "/".

Proceeding as per above, and as root, I entered the command:

"dd if=/dev/zero of=/sda2/swapfile"

The system responded with:

"dd: failed to open ‘/sda2/swapfile’: No such file or directory"

Is this because sda2 isn't mounted?
User avatar
AlanWalker
Level 4
Level 4
 
Posts: 223
Joined: Wed Jun 12, 2013 7:44 pm
Location: New York

Re: Enabling swap on LMDE

Postby martywd on Mon May 05, 2014 9:09 pm

@AlanWalker

In a Terminal Window run this command:
Code: Select all
sudo blkid


Add the following line to your '/etc/fstab' file using the UUID obtained from the 'blkid' command for your 'swap' partition in place of my example (xxxxxxxxxyyyyyyyyyyyyyyyzzzzzzzzzzz):
Code: Select all
UUID=xxxxxxxxxyyyyyyyyyyyyyyyzzzzzzzzzzz   none   swap   sw   0   0


Save the '/etc/fstab' file.

Run the following command:
Code: Select all
sudo swapon -a


Or REBOOT.

To check status of your 'swap' partition, run this command:
Code: Select all
sudo swapon -s

.
martywd
Level 3
Level 3
 
Posts: 119
Joined: Sun May 08, 2011 10:35 am
Location: Texas

Re: Enabling swap on LMDE

Postby kyphi on Mon May 05, 2014 9:12 pm

Depending on how much RAM you have installed, the absence of a swap partition may not be all that important.

I understand that you used gparted from the live DVD but have you got it installed now? If so, in gparted click on the swap partition and then open Partition from the top menu. That should state that the swap partition is "Active" and also its UUID.
If necessary edit your /etc/fstab file with sudo and enter the UUID followed by "none swap sw 0 0" so that it looks similar to this:

# swap was on /dev/sda2 during installation
UUID=fec38302-1ex8-415c-af12-f63e9428b491 none swap sw 0 0

Save before exit. the "none" entry refers to the mount point (swap is not mounted).
User avatar
kyphi
Level 5
Level 5
 
Posts: 857
Joined: Sat Jul 09, 2011 1:14 am
Location: Australia

Re: Enabling swap on LMDE

Postby AlanWalker on Mon May 05, 2014 9:29 pm

martywd wrote:@AlanWalker

In a Terminal Window run this command:
Code: Select all
sudo blkid


Add the following line to your '/etc/fstab' file using the UUID obtained from the 'blkid' command for your 'swap' partition in place of my example (xxxxxxxxxyyyyyyyyyyyyyyyzzzzzzzzzzz):
Code: Select all
UUID=xxxxxxxxxyyyyyyyyyyyyyyyzzzzzzzzzzz   none   swap   sw   0   0


Save the '/etc/fstab' file.

Run the following command:
Code: Select all
sudo swapon -a


Or REBOOT.

To check status of your 'swap' partition, run this command:
Code: Select all
sudo swapon -s

.

That did it! :D

Thanks.
User avatar
AlanWalker
Level 4
Level 4
 
Posts: 223
Joined: Wed Jun 12, 2013 7:44 pm
Location: New York

Re: Enabling swap on LMDE (Solved)

Postby AlanWalker on Mon May 05, 2014 9:41 pm

kyphi wrote:Depending on how much RAM you have installed, the absence of a swap partition may not be all that important.

I understand that you used gparted from the live DVD but have you got it installed now? If so, in gparted click on the swap partition and then open Partition from the top menu. That should state that the swap partition is "Active" and also its UUID.
If necessary edit your /etc/fstab file with sudo and enter the UUID followed by "none swap sw 0 0" so that it looks similar to this:

# swap was on /dev/sda2 during installation
UUID=fec38302-1ex8-415c-af12-f63e9428b491 none swap sw 0 0

Save before exit. the "none" entry refers to the mount point (swap is not mounted).

I've 1.9gb of available ram on this system (Lenovo T500) and I've never seen more than 60% of it in use at the most demanding of times. I was interested in how to enable swap because I was irked that space had been made available but not usable.

So! I've learned several new things from you and martywd. Time to add them to my notes. :D

I'll be back (I have other questions).

Thanks!
User avatar
AlanWalker
Level 4
Level 4
 
Posts: 223
Joined: Wed Jun 12, 2013 7:44 pm
Location: New York

Re: Enabling swap on LMDE

Postby martywd on Mon May 05, 2014 9:45 pm

AlanWalker wrote:That did it! :D

Thanks.

Glad it worked for ya.

One thing I should have added. If you haven't done so already, comment out with '#' at the beginning of that _old_ '/dev/sda2' line in your '/etc/fstab' file.
Code: Select all
/dev/sda2      Unknown      defaults     0     0

It might cause you headaches on boot up or reboots otherwise.

And. Edit the title of this post to add: [Solved] if you feel inclined?
.
martywd
Level 3
Level 3
 
Posts: 119
Joined: Sun May 08, 2011 10:35 am
Location: Texas

Re: Enabling swap on LMDE

Postby AlanWalker on Mon May 05, 2014 9:50 pm

martywd wrote:
AlanWalker wrote:That did it! :D

Thanks.

Glad it worked for ya.

One thing I should have added. If you haven't done so already, comment out with '#' at the beginning of that _old_ '/dev/sda2' line in your '/etc/fstab' file.
Code: Select all
/dev/sda2      Unknown      defaults     0     0

It might cause you headaches on boot up or reboots otherwise.

And. Edit the title of this post to add: [Solved] if you feel inclined?
.

Done on both counts.

Thanks.
User avatar
AlanWalker
Level 4
Level 4
 
Posts: 223
Joined: Wed Jun 12, 2013 7:44 pm
Location: New York

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: No registered users and 7 guests