Tuesday, June 08, 2010

"Power Outage"-Proof Your Mac

Ah, spring has sprung, the flowers are making me sneeze, and the birds are singing way too loud, way too early.  Spring showers have brought not only May flowers but frequent power failures that have rendered my lovely Mac unavailable when I'm out and about.  "This moron needs an UPS!" you say - I've been a little slow on the uptake, I'll admit, and after an entire life without one I've been aggravated enough to plunk down my $100 and get one.  I'm definitely not proud that I've gone for so long without one - it's been on the list, but it's always been put off then remembered the next time the power went out.

I opted for a unit from CyberPower because it said that it supported Mac and was $30 cheaper than a comparable model from APC.  I've always gone with APC and Tripp-Lite for my customers because, frankly, I don't know and trust CyberPower like I do the the other two.  But $30 is enough to convince me to try it, and it's my own computer, so noone but me will be aggravated when it breaks.  Hopefully I'm in for a pleasant surprise and the unit will be higher quality that I anticipated.

I plugged in the new unit (CyberPower 850VA model CP850AVRLCD), plugged in all my cords and wall warts (Linux box and iMac on the battery side, router, switch, and WAP on the surge only side), plugged it in, hooked up the USB cord to my iMac, and was pretty much done.  Surprisingly enough, OS X comes with built-in UPS management software that is under Apple -> System Preferences -> Energy Saver -> UPS tab.

But what about my open programs?  I want to run VirtualBox and save the state of the machine if my computer gets interrupted.  Safe Sleep seems like a good bet - it functions in MacBooks iMacs like Hibernate does in PC's - the contents of the RAM are saved to the HDD and the computer goes to sleep, powering the RAM and ready to wake in a moments notice.  If power is interrupted there is no loss because the RAM was saved to the hard drive and it is simply recovered the next time the computer powers up.  It's helpful to set your "Start up automatically after a power failure" option under Energy Saver so that can pick up where it left off automatically.  There is no Safe Sleep or hibernate function available on iMacs out of the box, but SmartSleep fixes that.  Download it, install it, then set your sleep state to Sleep & Hibernate.  I tested this by opening some apps, putting my iMac to sleep, pulling the plug, plugging it back in, and feeling the joy.

Next you will go to the UPS settings under Energy Saver and set your Computer Sleep to a sane amount of time.  5 minutes to 1/2 hour depending on how big your UPS is.  I've opted for safety and went with 5 minutes.   DO NOT go the extra step and configure any shutdown options - this will quit your programs and shut down.

Your computer will now go to sleep with the RAM contents saved after it has been on battery for the time you set.  If the battery runs out of juice the computer goes off.  When power is restored the computer comes back on.  Hopefully the power remains on for a while and allows the battery to recharge because too soon a repeat outage and your sleep timeout won't be reached before it's cut off.

No comments: