So you’ve got your the new OS X Lion and you are using a Macbook pro or Macbook Air?
We all know that one of the more important features of a laptop is its battery capacity, it makes no sense to have a laptop that only last for an hour on batteries, another important thing now a days, is that we all want our laptops to be “always on” I mean, like our phones, always in standby just like an iPad.
And, as you may have notice this are opposite features, if you have it always on you will loose battery and if you save battery, it will not wake up as fast as you may want it to do it.
Now, let’s understand a little bit the differences between sleep and hibernate:
In sleep mode the computer tries to cut the energy from all computer’s components like hard disks, display and others, and only keeps the power to the RAM, as there is where the current settings are stored.
In this mode the wake up time is really short (just a pair of seconds) but the power is still draining as RAM is working.
In this mode, the operating system is going to copy the RAM contents to the hard disk, and will shut the computer off, when you want it to wake up, it will boot from this image saved on the disk, and will restore the computer the last state it has before going to hibernate.
Enough, let’s now see how we can be sure we have the best of both worlds with our Macbook.
Let’s see the current state of the power management settings.
sudo pmset -g
You should see something like this:
Active Profiles: Battery Power -1* AC Power -1 Currently in use: standbydelay 1200 standby 1 halfdim 1 sms 1 panicrestart 157680000 hibernatefile /var/vm/sleepimage disksleep 10 sleep 10 hibernatemode 3 ttyskeepawake 1 displaysleep 2 acwake 0 lidwake 1
There are three parameters that we want to check here:
From the man page:
hibernatemode takes a bitfield argument defining SafeSleep behavior. Passing 0 disables SafeSleep altogether, forcing the computer into a regular sleep.
standby causes kernel power management to automatically hibernate a machine after it has slept for a specified time period. This saves power while asleep. This setting defaults to ON for supported hardware. The setting standby will be visible in pmset -g if the feature is supported on this machine.
standbydelay specifies the delay, in seconds, before writing the hibernation image to disk and powering off memory for Standby.
With hibernatemode in “3” we have the default settings, which means that the computer will use sleep and not hibernate, as the default when the lid is closed, but because standby is set to ON, the computer will wait standbydelay seconds, before switching from sleep to hibernate
As you can see this is great, as you can now close the lid of your laptop, and you have n seconds to go back to it, and still have a fast “boot” time, but if you stay away more than that, it will go into hibernate mode, and will save your battery.
You can change the time you want your laptop to wait before going into hibernate mode with this command:
sudo pmset -a standbydelay 1200
Change 1200 to the number of seconds you want it to wait in sleep mode before going to hibernate mode.
If you need to set you laptop in sleep mode and turn on the standby mode (They should be on, as those are the default), enter these commands.
sudo pmset -a standby 1
sudo pmset -a hibernatemode 3
With those settings, I have a laptop that waits for me in sleep mode for 30 minutes, after that, it better goes to hibernate as it may take longer for me to return to work :).
One last note:
If you forget to close the lid, the sleep parameter will dictate when your computer is going to go to sleep, that setting is in minutes, so in my case it will wait for 10 minutes on, and then if there is no activity on the keyboard or mouse, it will go to sleep for 30 minutes and finally to hibernate.
If you enjoyed the article, please share it