Modify the partition map to recover a damaged iPod

Feb 24, '06 05:38:00AM

Contributed by: lucas911993

After my iPod (3G 15GB) spent a couple of weeks sitting stoically alone in my backpack, I pulled it out only to find that the Apple symbol was displayed indefinitely. I'll call this the "Continuous Apple Symbol of Musical Death" (CASMD).

After various iPod updates on Mac and PCs, disk mode mounting, and complete erasing and reformatting of the drive, I was still receiving the CASMD. So I pulled up macosxhints.com and macgeeker.com to find a solution. Well, a solution I did not find, so I started troubleshooting by putting the iPod in disk mode (reset with Menu+Play buttons, then hold Forward and Backward before the CASMD appears).

From the Terminal, pdisk /dev/diskX -dump (where X is the iPod's disk number) revealed that I had an intact partition table that looks like this:

Partition map (with 512 byte blocks) on '/dev/disk2'
 #:                type name                length   base        ( size )
 1: Apple_partition_map partition map           62 @ 1
 2:             Apple_MDFW firmware          65536 @ 63          ( 32.0M)
 3:                Apple_HFS disk         29231920 @ 65599       ( 13.9G)

Device block size=512, Number of Blocks=29297520 (14.0G)
DeviceType=0x0, DeviceId=0x0
This indicates that the MBR (#1 named Apple_partition_map) was functioning, I think. Since I had run Disk Utility and verified the disk partition, I concluded that this was also functional. That means #2 firmware is the culprit. I used dd if=/dev/disk2s2 of=iPod_firmware.backup to make a copy of the firmware for restoration purposes. I don't know if this is needed, espcially since I was theorizing that it was corrupt, but everything else I read recommended this backup. Then I used pdisk to edit the partition map. It now looks like this:
Partition map (with 512 byte blocks) on '/dev/disk2'
 #:                type name                length   base        ( size )
 1: Apple_partition_map partition map           62 @ 1     
 2:                Apple_Free Extra          65537 @ 63          ( 32.0M)
 3:             Apple_MDFW firmware          65536 @ 65600       ( 32.0M)
 4:                Apple_HFS disk         29166321 @ 131199      ( 13.9G)
 5:                Apple_Free Extra             63 @ 131136
I simply skipped the orginal firmware sectors and place a partition of identical size, name, and type, in the next sectors. I subtracted out the remaining sectors (29166231) and created the disk partition. pdisk returned an error if I tried to use the last 63 sectors, but I don't know why.

Upon writing of the new table, the iPod was immediately recoginzed, at which point I had to re-initialize the disk partition in order for it mount. I used dd if=iPod_firmware.backup of= /dev/disk2s3 (iPod is disk #2 and firmware is partition #3) to restore the firmware. For good measure, I used Disk Utility with the Zero Out Deleted Files option to erase the disk.

I unmounted the iPod via Disk Utility, and then reset it from disk mode. iTunes popped up and said the iPod needed an update. I clicked OK, it updated, and unmounted. I unplugged the iPod from the PowerBook, hooked it to the AC power supply, held my breath, and restarted for the final time. It booted normally, and is reloading my songs as I type this!

Conclusion:
Either the partition map was corrupt and rewriting it solved the problem, or the orginal sectors (63-65599) of the firmware partition are corrupt and moving that partition solved the problem. As a side note, it seems that the iPod only looks for partition names and types, not physical locations.

Good luck! I may have left something out, so post if you have any questions.

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2006021923332755