Not enough free swap space to hibernate

Karl F. Larsen klarsen1 at gmail.com
Wed Mar 25 13:07:07 UTC 2009


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





More information about the ubuntu-users mailing list