[ale] Linux swap space vs hibernate, power shutdown settings

David Tomaschik david at systemoverlord.com
Sat Nov 5 21:43:33 EDT 2011


On 11/05/2011 06:48 PM, Ron Frazier wrote:
> Hi all,
>
> I've verified experimentally that Ubuntu 10.04 will not let the machine 
> hibernate if there is no swap space.  This seems to confirm what I read 
> elsewhere that the swap space is used for the hibernation data.
That's correct.
> (Windows uses a separate file.) 
Yes, which requires a functional file-system as of the time of resume,
and means the filesystem journal must be clean before hibernating, etc. 
(In other words, a design decision.)
> I believe that you must have a swap 
> space equal to and perhaps a bit larger than RAM in order to hibernate.
This is correct, if you use 100% of your RAM.  In fact, you must have
enough space for anything that was in swap as well.  (It will be
relocated during hibernate.)

To be more precise, prior to hibernating, dirty pages that are backed by
disk are flushed to disk, and pages containing disk cache are not
written to the hibernate space.

That being said, I believe the tools do not allow hibernation to disk if
you have less swap free than you have RAM, as it cannot guarantee success.
>  
> I prefer not to use standby or suspend since, at least in terms of 
> Windows in the past, that has been known to cause data corruption since 
> the standby data is in RAM and could be lost if the battery is weak, 
> etc.  As I write this, I'm noticing that my laptop offers a suspend 
> option in Linux and the desktop does not.  In any case, if I don't want 
> to do a full shutdown, I prefer to have all the system state data saved 
> to the disk and all the power shut down.
I prefer to use standby/suspend because it is faster to enter and exit
suspend state and my laptop battery will last for days while suspended. 
Personal preference.
> I'd be interested to know whether setting the power settings to shutdown 
> or hibernate is better in case the UPS battery gets critically low after 
> a power failure.  In my case, the UPS only runs 3-4 minutes on the 
> desktop, so I currently have that setting on shutdown.  I figured the 
> system can shut down faster than it can hibernate.  If anyone knows, I'd 
> also like to know how to set the shutdown time on the Gnome power 
> manager.  If, for example, the system shuts down when the UPS is at 10% 
> after a power failure, this is bad for me since that amounts to about 18 
> seconds of warning before the battery dies.  I don't think even Linux 
> can shut down that fast.
>
> Sincerely,
>
> Ron
>
Shut down may or may not be faster than hibernate, but I think there's a
more important point: if you have unsaved work, shut down will lose that
work.  Hibernate will not.  I personally consider a UPS with a lifetime
of only 3-4 minutes only protection against brief power "blinks" and
brown-outs.  (They also usually have 1st class surge suppression, as an
added bonus.)

Time how long your system takes to shut down and how long it takes to
hibernate.  Make sure you do both with the same apps loaded, etc.  I'd
be interested to see any hard data.

David

-- 
David Tomaschik, RHCE, LPIC-1
System Administrator/Open Source Advocate
OpenPGP: 0x5DEA789B
http://systemoverlord.com
david at systemoverlord.com



More information about the Ale mailing list