Thursday, February 21, 2008

MacBookPro Faster Sleep

When I close the lid on my MacBookPro the white light stays on for 20-30 seconds... and then starts pulsing. It is taking this time to write the RAM contents to the HD in case the battery runs down or is removed this allows the computer to wake up and resume where I left off. There are a couple of command line options that one can enter to turn this on and off. Per this hint you can also save a shell script to make this process easier. I've included the script text here:



if [ "$SETTING" == "off" ]; then
echo "Turning off safe sleep"
sudo pmset -a hibernatemode 0
sudo nvram "use-nvramrc?"=false
echo "Don't forget to reboot!"
echo You are now free to remove your sleepimage file at /private/var/vm/sleepimage
elif [ "$SETTING" == "on" ]; then
echo "Turning on safe sleep"
sudo pmset -a hibernatemode 3
sudo nvram "use-nvramrc?"=true
echo "Don't forget to reboot!"
echo "Usage: safesleep on | off"

I put this in a file named safesleep in this directory: ~/Scripts/shell/. ~ is a shortcut for the current user's home directory. Then I made the file executable by running chmod on it:

sudo chmod ug+x ~/Scripts/shell/safesleep

I also had to add the ~/Scripts/shell directory to my path, so I created a new file at ~/.profile, into which I put:

export PATH="/bin:/sbin:/usr/bin:/usr/sbin:~/Scripts/shell"

Restart the shell (quit Terminal) and the script is ready to rock. Syntax is either "safesleep on" or "safesleep off". The script will remind you to reboot the computer for it to take effect.

I also installed the Dashboard widget Deep Sleep. This fellow causes the laptop to directly enter deep sleep. Deep sleep is a state that uses no power, the white light does not pulse, it is completely off. You do have to wait the 20-30 seconds for the ram to be written to the hard drive.

The combination of a safesleep off for fast normal sleeping, and Deep Sleep for no battery long term sleeping works well for me.

Tuesday, February 19, 2008

Waving Goodbye to Hegemony

This is a interesting New York Times article about the "New World Order" - titled Waving Goodbye to Hegemony. My brother Josh sent this to me.

GMail This Bookmarklet e-mail is hosted at Google Apps. When that was upgraded to the new GMail codebase (version 2) my GMail This and Compose bookmarklets stopped working. The solution, add ui=1 to the parameters list. Here is my complete GMail This bookmarklet. And here is my Compose bookmarklet. I have made both windows a bit larger than other bookmarklets. Also, you'll need to change the domain after /a/ to your Google Apps domain. Don't know what I'm talking about? Start here.

Thursday, February 14, 2008

Using Leopard Time Machine with Network Share

I just upgraded to Leopard. I want to use Time Machine to back up my laptop, but the only hard drive I have with extra space is an external hard drive currently plugged into my Mac Mini.

My first problem is that I don't have an open partition of the right size. To solve this I have created a 50 GB disk image. I setup that disk image with no encryption and a format of "read/write disk image." It took a few hours to create this image.

Then I mounted this image on the Mini and shared it through AFP (Personal File Sharing). Then I mounted this shared drive on the laptop. I could not tell Time Machine to use this network share... it did not appear. The solution was to change a system preference via the command line:

defaults write TMShowUnsupportedNetworkVolumes 1

I heard about this technique here.

Then I told Time Machine to start backing up now. It failed with the error message: Time Machine Error The backup disk image could not be created. Eventually I found this thread. It advised me to:

1. Start Time Machine backup. Wait a little.
2. On the server, make a copy (cp -r) of the in-progress disk image.
3. Let Time Machine fail and delete the image.
4. Rename (mv) the copy created earlier to the same name of the deleted Time Machine sparsebundle image.

This worked!

Favorites from my Blogroll