Welcome! Log In Create A New Profile

Advanced

swap space not used

Posted by metacircle 
swap space not used
September 10, 2010 09:10AM
Hello,

I created a ext2 partition as sda1 and a swap partition as sda2 just as written in the tutorial. Debian installation worked flawlessly. If I type "free -m" I get the following:

root@debian:/# free -m
total used free shared buffers cached
Mem: 122 29 93 0 0 19
-/+ buffers/cache: 8 113
Swap: 0 0 0
root@debian:/#

Which tells me that no swap is available?

Any ideas how to fix that? I am pretty new to linux so any beginners help is much appreciated.

Thank you.

edit: fdisk -l gives me:

Disk /dev/sda: 16.0 GB, 16000221184 bytes
255 heads, 63 sectors/track, 1945 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00049e50

Device Boot Start End Blocks Id System
/dev/sda1 1 1880 15101068+ 83 Linux
/dev/sda2 1881 1945 522112+ 82 Linux swap / Solaris



Edited 1 time(s). Last edit at 09/10/2010 09:12AM by metacircle.
ecc
Re: swap space not used
September 10, 2010 10:00AM
metacircle Wrote:
-------------------------------------------------------
> I created a ext2 partition as sda1 and a swap partition as sda2 just as written in the tutorial.
> Debian installation worked flawlessly. If I type "free -m" I get the following:
>
> root@debian:/# free -m
> total used free
> shared buffers cached
> Mem: 122 29 93
> 0 0 19
> -/+ buffers/cache: 8 113
> Swap: 0 0 0
> root@debian:/#
>
> Which tells me that no swap is available?

In addition to creating the disk partition, you need to do two additional things to use it as swap space:

1. Format the swap partition:
mkswap /dev/sda2

2. Indicate in /etc/fstab that this partition should automatically be used as swap space, by adding this line:
/dev/sda2 none swap sw

Then either reboot, or (just this once) do "swapon -a".
Re: swap space not used
September 10, 2010 10:33AM
Thank you it worked perfectly! :)

Is this normal behaviour of the installer script not to activate the swap space?
MaFL
Re: swap space not used
September 10, 2010 01:49PM
Yes
Re: swap space not used
September 10, 2010 01:55PM
It seems to me that Lenny automatically activated swap space. I never checked Squeeze until reading the post. Sure enough, it showing swap space zero. I followed ecc's fix and it works fine now.
May be Jeff could modify the script to activate swap during installation?



Edited 1 time(s). Last edit at 09/10/2010 03:25PM by twinclouds.
Re: swap space not used
September 10, 2010 02:25PM
It can be a bit of a gotcha this, although fine if you know about.

I've been running a local dovecot IMAP server on a fresh squeeze install on my new dock for the last week. For the life of me I couldn't work out why my getmail scripts suddenly started to crash when pulling mails from my ISP POP3 accounts to populate the local IMAP server - everything had been fine up until then. A bit of digging showed that getmail was barfing on some large mails, with Python crashing as it ran out of memory. Then I remembered seeing something about swap space - after checking I saw that it wasn't being used, so I updated my fstab and went through the trivial steps to enable it. After that, getmail was fine again and the dock could deal with the large mail download ;-) .

PS - thanks to Jeff for the work he's done here in general. If it wasn't for people like him with the dockstar and Martin Michlmayr with the NSLU2 and Sheevaplug then my home network with web/file and mailserver wouldn't be half what it is now!
Re: swap space not used
September 10, 2010 03:55PM
Thanks for the feedback. This was just an oversight on my part.

The installer has been updated to activate the swap partition.

-- Jeff
Megabug
Re: swap space not used
September 16, 2010 10:13AM
Hi,

I also had to change the priority of the swap to 1. After just "swapon /dev/sda2" it was always -1 priority and swap was assigned but not used.

My fstab for swap looks like this:

/dev/sda2 none swap sw,pri=1 0 0

After this my swap is used. :)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: