FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 03-25-2009, 09:21 AM
Vincent Arnoux
 
Default Not enough free swap space to hibernate

Hello the list,
I have 1 GB or RAM and 1 GB of swap. I reboot rarely my laptop, but
instead suspend it to disk. After a few days and intensive use of
RAM/swap (virtual machines essentially), I end up when trying to
hibernate with the message: "Not enough swap".
During hibernation, RAM is being written to swap partition. If there
is not enough space, suspend to disk just fails. How can I force my
swap to be emptied? I could use a swap file, but I read Ubuntu current
kernel can't hibernate using a swap file.

Thanks,
Vincent

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-25-2009, 11:29 AM
Matthew Flaschen
 
Default Not enough free swap space to hibernate

Vincent Arnoux wrote:
> Hello the list,
> I have 1 GB or RAM and 1 GB of swap.

Well, that's your problem. 2 GB is typically recommended for 1 GB
physical memory. That's what I have, and it works fine.
> During hibernation, RAM is being written to swap partition. If there
> is not enough space, suspend to disk just fails. How can I force my
> swap to be emptied?

I believe you can do:

swapoff swaplocation

swaplocation can be either a partition or a file. I haven't verified,
but this should free the entire partition for hibernating. Of course,
if you don't have enough physical memory, swapoff can trigger the out of
memory killer, which will cause (seemingly) random processes to die.

Matt Flaschen

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-25-2009, 11:34 AM
"Jason Crain"
 
Default Not enough free swap space to hibernate

On Wed, March 25, 2009 5:21 am, Vincent Arnoux wrote:
> I have 1 GB or RAM and 1 GB of swap. I reboot rarely my laptop, but
> instead suspend it to disk. After a few days and intensive use of
> RAM/swap (virtual machines essentially), I end up when trying to
> hibernate with the message: "Not enough swap".
> During hibernation, RAM is being written to swap partition. If there
> is not enough space, suspend to disk just fails. How can I force my
> swap to be emptied? I could use a swap file, but I read Ubuntu current
> kernel can't hibernate using a swap file.

The only way to force swap to be emptied is to close running programs to
free RAM. You need more swap. I would recommend 2GB. I believe GParted
from the installation disc can resize your partitions so you can increase
the size of the swap partition.

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-25-2009, 11:45 AM
Vincent Trouilliez
 
Default Not enough free swap space to hibernate

> The only way to force swap to be emptied is to close running programs to
> free RAM.

I have the same problem, Ubuntu often uses lots of swap even though
there is bags of available RAM, therefore slowing down the system with
lots of useless disk access).

I found that closing all programs doesn't empty the swap at all. All it
does is get (some of, not all) the RAM.

The solution I found to empty the swap is to disable it: it forces the
kernel to empty it first. Then I just re-enable it as soon, and I the
system starts from a clean sheet so to speak.

To disable swap:

$ sudo swapoff -a

Then re-enable it:

$ sudo swapon -a


There is also another use case for this off/on trick:

When I was (not using it anymore) the Hibernation feature, I noticed
that when resuming, the system was very slow... it was using swap a
lot, even though zero swap was used before hibernating was triggered.
So you basically have a responsive/snappy system before hibernating,
and when resuming, ytou get a slow system... how nice.

So turning the swap off/on following a resume, fixed the problem.


HTH

--
Vince

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-25-2009, 12:07 PM
"Karl F. Larsen"
 
Default Not enough free swap space to hibernate

Vincent Trouilliez wrote:
>> The only way to force swap to be emptied is to close running programs to
>> free RAM.
>>
>
> I have the same problem, Ubuntu often uses lots of swap even though
> there is bags of available RAM, therefore slowing down the system with
> lots of useless disk access).
>
> I found that closing all programs doesn't empty the swap at all. All it
> does is get (some of, not all) the RAM.
>
> The solution I found to empty the swap is to disable it: it forces the
> kernel to empty it first. Then I just re-enable it as soon, and I the
> system starts from a clean sheet so to speak.
>
> To disable swap:
>
> $ sudo swapoff -a
>
> Then re-enable it:
>
> $ sudo swapon -a
>
>
> There is also another use case for this off/on trick:
>
> When I was (not using it anymore) the Hibernation feature, I noticed
> that when resuming, the system was very slow... it was using swap a
> lot, even though zero swap was used before hibernating was triggered.
> So you basically have a responsive/snappy system before hibernating,
> and when resuming, ytou get a slow system... how nice.
>
> So turning the swap off/on following a resume, fixed the problem.
>
>
> HTH
>
> --
> Vince
>
>
top - 06:56:10 up 13:30, 3 users, load average: 0.25, 0.20, 0.17
Tasks: 126 total, 4 running, 122 sleeping, 0 stopped, 0 zombie
Cpu(s): 10.4%us, 1.7%sy, 0.0%ni, 88.0%id, 0.0%wa, 0.0%hi, 0.0%si,
0.0%st
Mem: 1034328k total, 817656k used, 216672k free, 89356k buffers
Swap: 1959920k total, 0k used, 1959920k free, 360680k cached

There seems to be some cached and some buffers. But this Hardy is not on
a laptop. As you see I have 1 Gig of RAM and 2 Gig of Swap partition.

Karl


--

Karl F. Larsen, AKA K5DI
Linux User
#450462 http://counter.li.org.
PGP 4208 4D6E 595F 22B9 FF1C ECB6 4A3C 2C54 FE23 53A7


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-25-2009, 12:12 PM
Vincent Trouilliez
 
Default Not enough free swap space to hibernate

On Wed, 25 Mar 2009 07:07:07 -0600
"Karl F. Larsen" <klarsen1@gmail.com> wrote:

> Vincent Trouilliez wrote:
> > I have the same problem, Ubuntu often uses lots of swap even though
> > there is bags of available RAM, therefore slowing down the system with
> > lots of useless disk access).
> >
> > I found that closing all programs doesn't empty the swap at all. All it
> > does is get (some of, not all) the RAM.
> >
> > The solution I found to empty the swap is to disable it: it forces the
> > kernel to empty it first. Then I just re-enable it as soon, and I the
> > system starts from a clean sheet so to speak.
> >
> >
> >
> top - 06:56:10 up 13:30, 3 users, load average: 0.25, 0.20, 0.17
> Tasks: 126 total, 4 running, 122 sleeping, 0 stopped, 0 zombie
> Cpu(s): 10.4%us, 1.7%sy, 0.0%ni, 88.0%id, 0.0%wa, 0.0%hi, 0.0%si,
> 0.0%st
> Mem: 1034328k total, 817656k used, 216672k free, 89356k buffers
> Swap: 1959920k total, 0k used, 1959920k free, 360680k cached
>
> There seems to be some cached and some buffers. But this Hardy is not on
> a laptop. As you see I have 1 Gig of RAM and 2 Gig of Swap partition.
>
> Karl

What's your point, wrt to my post which you quoted, or even the OP ?

--
Vince

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-25-2009, 12:27 PM
"Mihamina Rakotomandimby (R12y)"
 
Default Not enough free swap space to hibernate

Matthew Flaschen wrote:
> swapoff swaplocation
>
> swaplocation can be either a partition or a file. I haven't verified,
> but this should free the entire partition for hibernating. Of course,
> if you don't have enough physical memory, swapoff can trigger the out of
> memory killer, which will cause (seemingly) random processes to die.

You can really have surprising effects with that radical tip.
It could be a bit more secure if the user first close all closable running
applications.
But then, if the goal is to hibernate, it becomes no worth.

--
Chef de projet chez Vectoris
Phone: +261 33 11 207 36
System: xUbuntu 8.10 with almost all from package install
http://www.google.com/search?q=mihamina+rakotomandimby

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-25-2009, 12:31 PM
Vincent Arnoux
 
Default Not enough free swap space to hibernate

All,
Thanks for your answers. I knew about the golden rule swap size = 2 x
RAM size, but on a 10 GB system, this rule is a little bit hard to
observe. Dura lex sed lex, I will use it for my install of Jaunty.
Thanks for the swapoff/swapon trick, I am going to integrate it in my
hibernation script.

Vincent

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-25-2009, 02:31 PM
Derek Broughton
 
Default Not enough free swap space to hibernate

Vincent Arnoux wrote:

> Hello the list,
> I have 1 GB or RAM and 1 GB of swap. I reboot rarely my laptop, but
> instead suspend it to disk. After a few days and intensive use of
> RAM/swap (virtual machines essentially), I end up when trying to
> hibernate with the message: "Not enough swap".
> During hibernation, RAM is being written to swap partition. If there
> is not enough space, suspend to disk just fails. How can I force my
> swap to be emptied? I could use a swap file, but I read Ubuntu current
> kernel can't hibernate using a swap file.

You can't force your swap to be emptied (except by stopping all processes),
though you can minimize it by making sure you're using no more programs
than can fit in your real memory and then doing something with all of those
programs (to force them to swap back in), and you can't expect to be able
to hibernate with no more swap memory than real memory.

While there's a lot more actually happening, think of hibernation as simply
swapping out _all_ current processes. This means that you need enough
space in there for all the storage of all the current programs, which
generally means about 2x your real memory.

otoh, if you simply save your virtual machines (ie, hibernate them in their
own files), you shouldn't have an issue with your other memory. Hibernate
supports the concept of stopping/starting services when hibernating and
resuming, so you could write a script to save/restore the VMs.
--
derek


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 03-25-2009, 02:32 PM
Guy Thouret
 
Default Not enough free swap space to hibernate

On Wed, 2009-03-25 at 13:45 +0100, Vincent Trouilliez wrote:
> I have the same problem, Ubuntu often uses lots of swap even though
> there is bags of available RAM, therefore slowing down the system with
> lots of useless disk access).

If you have lots of available RAM you could try adjusting the swappiness
of the kernel by changing the value of /proc/sys/vm/swappiness.

Values in the range 0 to 100. The higher the value, the more the kernel
will swap out pages from RAM to disk and vice versa.

So if you want to minimise use of swap space and keep pages in RAM set
the kernel swappiness to 0.

To make a permanent change, add the line vm.swappiness = value
to /etc/sysctl.conf where value is the desired swappiness value.

There's an old discussion of it at http://kerneltrap.org/node/3000

Guy.


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 02:52 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org