Ads by TechWords
Subscribe to our e-mail newsletters
For more info on a specific newsletter, click the title. Details will be displayed in a new window.
Computerworld Daily News (First Look and Wrap-Up)
Computerworld Blogs Newsletter
The Weekly Top 10
More E-Mail Newsletters 

The cure for a hungry, sleepy laptop

Rate this
Rated -6
514 Votes

When I started using a MacBook Pro last summer, I found two features to dislike. One was the hard drive space — or the lack thereof. 120 GB was a big improvement over my older PowerBook's 80 GB, but faced with my growing movie, photo, and music collection, it still wasn't enough. I offload as much ancillary data as I can to external hard drives, but those volumes aren't subjected to the daily backups that the laptop's internal drive is, so I'm eager to locally retain as much data as possible. I should've purchased the computer with a customized, larger, inbuilt drive, as I suspect it would now be more expensive to make such a modification post-purchase. Live and learn.

The other feature that confounded me was how lazily the MacBook Pro went to sleep. If I closed the lid and then immediately had to reawaken it for a previously forgotten task, I'd have to wait 20-30 seconds before it would wake. Why the machine was comatose for that time, I didn't know. Other Mac users suggested I'd gotten a lemon; I decided it was a lesson in patience. Little did I suspect this issue was connected to my ever-shrinking free hard drive space.

When I recently spied a full volume in my computer's near future, I took to doing some spring cleaning. My inspection began with WhatSize, a utility that maps a directory tree of which files and folders are consuming the most bits. iTunes, Juiced.GS back issues — these were the usual suspects. But this time, I found something I'd never noticed before: a single file, weighing in at more than 2 GB, and found at the path /Volumes/Macintosh HD/private/var/vm/sleepimage.

A quick Google search informed me of the purpose of this file: when my MacBook Pro goes to sleep, those 20 seconds of limbo are spent creating an image of my RAM. The laptop's battery preserves the state of the physical RAM, but should the battery die (or be removed) and the RAM erased, the sleepimage file functions as a backup, allowing the RAM's contents to be restored once power is.

A great safety feature — but one I'm unlikely to use, as I have only one battery, and the most travelling my computer does is from outlet to outlet. And since the sleepimage file is at least as big as the machine's installed RAM — in my case, two gigabytes — I'd be better off without it. The Web site Mac OS X Hints therefore offers these two commands which, when typed into the Terminal, will disable the creation of the sleepimage file:

sudo pmset -a hibernatemode 0
sudo nvram "use-nvramrc?"=false

I could then safely delete my boot volume's existing sleepimage with this Terminal command:

sudo rm /private/var/vm/sleepimage

A quick reboot to ensure the above settings have taken effect, and poof: I had an easy-to-sleep MacBook and at least as much reclaimed hard drive space as I have RAM. Should I ever need the safe sleep feature re-enabled, the above page also offers instructions for reversing the procedure.

Tony Diaz contributed to this post.

What People Are Saying

Rate this
Rated +6
484 Votes

Sleep Image

I've known about this since I got my MacBook Pro last September. Well, I knew about it beforehand. I had read something about it somewhere...

I have 4GB of RAM (not Apple RAM) installed and I know it's taking up 4GB of extra space, but until I need the space (and I'm sure I will one day), I'll leave it there.

Of course it might be interesting in my Microcomputer Maintenance class. The teacher is an advocate of not letting your computer sleep. But then he's a Windows user. I know Windows can do the same, but he's had back luck with it...

Rate this
Rated +13
531 Votes

Nice!

I have the same problem with my MacBook Pro. I always chalked it up to a lemon machine as well. I'll give this a try!

Rate this
Rated +15
509 Votes

Disable Sleep Mode when Lid Closed

One annoying behavior of MacBooks is its sleep mode when the lid is closed. What if you want to listen to music only and not have the lid open or the brightness always turned down? Well there are various solutions you can apply to tweaking this sleep behavior. I posted detailed suggestions for this here:
http://pcwizkid.blogspot.com/2008/02/macbook-disable-sleep-mode-when-lid.html

Cheers
PCWizKid