Clockworkmod Recovery Failure

I tried updating CyanogenMod 9 on my Galaxy Nexus.  The first step is to perform a Nandroid backup.  You can do that by powering off the phone, holding volume up and down and then power until the phone vibrates.  This might take 15 seconds or so.  The Android logo will appear on the screen with a big green arrow above it that says “Start”.  Let go of the keys.  Use volume down to select Recovery Mode and press Power.  Select “backup and restore”, then “backup.”

After loading the new CyanogenMod ROM, the phone wouldn’t boot right.  It would start, but not connect to the  phone network.  After a while it’d reboot itself.  I’d had this problem once before.  I rebooted into Recovery and tried a restore, but it failed with the message “Error while restoring /data!”  Googling recommends wiping the phone to factory state and reloading CyanogenMod.

The first step is to save the last Nandroid backup.  To do this, start Recovery, then select “Mounts and Storage”, then “mount /data”.  Then connect the phone via USB to your computer and on your computer, change to the android SDK platform-tools directory and
$ adb pull /data/media/clockworkmod/backup
You might have to run this command with sudo if you don’t have UDEV rules set up correctly.  Each directory in backup is a Nandroid backup that has a TAR file of cache, data and system, a boot and recovery image and an MD5 sum.

After the backups are secure, restore the phone to a factory state.

When the phone starts in activation mode, just skip everything it asks for, then in settings, under developer options, turn on USB debugging.  This will let you download su.zip:

$ adb push su.zip /sdcard/.

As mentioned in the Root instructions.

After you have the phone rooted, create the ClockworkMod backup directory:

$ adb shell

# mkdir -p /sdcard/clockworkmod/backup

# exit

And copy your backups to the phone:

$ adb push clockworkmod/backup /sdcard/clockworkmod/backup/.

Then on the phone (while still in recovery mode), Select “backup and restore”, then “restore” and choose your backup.  After the restore completes, reboot the phone.

Alternately, you can restore the data partition of the backups with Titanium  Backup.