Skip to content

Instantly share code, notes, and snippets.

@VinDuv
Created August 25, 2021 18:13
Show Gist options
  • Save VinDuv/7aaf08e41b8b6f09ab1d2b7466731569 to your computer and use it in GitHub Desktop.
Save VinDuv/7aaf08e41b8b6f09ab1d2b7466731569 to your computer and use it in GitHub Desktop.
Restore a classic iPod to HFS+ without iTunes

How to restore a classic iPod to Mac format (HFS+) without iTunes

This tutorial explains how to reinstall the firmware of a classic iPod (tested on iPod 3G) to Mac format (Apple partition map and HFS+ filesystem — “MacPod”), without using iTunes. This is useful when you replace the iPod’s original HDD.

Use case

If you can use iTunes for this task, you should probably use it. If you want a manual restore but are OK with a Windows-formatted iPod, you can follow this guide instead.

In my case, I had to do this because :

  • I want a Mac formatted iPod because I’m only going to use it on a Mac, and it seems more natural anyway.
  • iTunes (for Mac) refuses to restore my iPod 3G because it’s connected using USB; it requires FireWire for this task.
  • My iPod refuses to work when connected using FireWire (it actually crashes my Mac); it’s probably because of the Y cable I’m using, but I don’t have other cables handy.

Connecting the iPod

After changing the disk of a classic iPod and powering it up (make sure it’s charged enough), it should display a folder with an exclamation point. At this point, you can connect it to your Mac; it should enter Disk Mode and its hard drive should mount on your computer.

If you get a “This drive is not readable” message, click “Ignore”.

If the iPod refuses to go into Disk Mode, you can force it into Disk mode by pressing a certain combination of keys. On the iPod 3G you can do the following:

  • Press the Menu and Play/Pause keys simultaneously until the screen goes blank
  • Immediately after, press the Previous and Next keys until the Disk Mode screen appears.
  • Plug the iPod to your computer.

Firmware downloading

You should be able to find the firmware for your iPod on this page (bottom dropdown):

https://www.felixbruns.de/iPod/firmware/

This downloads an IPSW file, which is in fact a ZIP file. Uncompress it to get the firmware file Firmware-X.Y.Z. This is the file that needs to be copied to your iPod.

Partitions sizing

To partition the iPod disk, you will need to use pdisk, which manipulates partition sizes in 512-bytes sectors, so you might want to calculate the partition sizes beforehand:

  • The partition map is 62 sectors, and occupies sectors 1-63 (non inclusive).
  • My iPod 3G’s firmware file is 4563968 bytes, or 8914 sectors. Since the firmware is unlikely to change in the future, I can use a partition of this exact size for the firmware, occupying sectors 63-8977 (non inclusive).
  • The rest of the disk (sectors 8977 and up) will be the iPod’s data partition, formatted in HFS+.

Partitioning

After connecting the iPod to your Mac, run diskutil list and find the disk identifier (diskX) corresponding to your iPod, which is probably at the end of the list. For instance:

/dev/disk5 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                                                   +8.0 GB     disk5

Here, the disk identifier is disk5. Make sure this is the right disk (by checking the size), so you don’t accidentally repartition the wrong one!

Run diskutil unmountDisk diskX to make sure the system is not using the disk, then launch sudo pdisk /dev/disk5 (and enter your password) to start the disk partition tool:

pdisk: No valid block 1 on '/dev/diskX'
Edit /dev/diskX -

Use i to initialize the partition map (just press Return to accept the default values):

Command (? for help): i
A physical block is 512 bytes: 
A logical block is 512 bytes: 
size of 'device' is 16777216 blocks (512 byte blocks): 
new size of 'device' is 16777216 blocks (512 byte blocks)

Note that pdisk has automatically detected the size of the disk. In the next step, you’ll need to calculate the size of the data partition, ensuring that it fits in the disk. In my case, the data partition starts at sector 8977, and the disk is 16777216 sectors long, so the partition size will be:

16777216 - 8977 = 16768239

Use s to change the partition map size to 62, so the firmware partition starts at block 63. By default, pdisk seems to create a 63-sector partition map (sectors 1 to 64 non-inclusive) do the first disk partition starts on sector 64 and is 4KB aligned. This will improve performance of some recents HDDs, but is probably not needed for the iPod.

Command (? for help): s
New size: 62

Create the firmware partition using C. You need to put the correct size for your iPod firmware, and put the correct type Apple_MDFW (the name is probably not important though):

Command (? for help): C
First block: 63
Length in blocks: 8914
Name of partition: Firmware
Type of partition: Apple_MDFW

Create the data partition using c. You can choose the partition name you want, but it doesn’t matter (it’s not the name displayed in the Finder or in iTunes):

Command (? for help): c
First block: 8977
Length in blocks: 16768239
Name of partition: iPod

You can them use the p command to check that everything’s OK:

Command (? for help): p

Partition map (with 512 byte blocks) on '/dev/disk5'
 #:                type name       length   base     ( size )
 1: Apple_partition_map Apple          62 @ 1       
 2:          Apple_MDFW Firmware     8914 @ 63       (  4.4M)
 3:           Apple_HFS iPod     16768239 @ 8977     (  8.0G)

Device block size=512, Number of Blocks=16777216 (8.0G)
DeviceType=0x0, DeviceId=0x0

Write the partition table (w) and quit pdisk (q):

Command (? for help): w
Writing the map destroys what was there before. Is that okay? [n/y]: y
The partition table has been altered!

Command (? for help): q

(If you get a “This drive is not readable” message, click “Ignore”).

Formatting

Copy the firmware to partition 2 using dd:

$ sudo dd if=Firmware-X.Y.Z of=/dev/diskXs2 bs=512

Format the data partition 3 as HFS+ (you can replace iPod with the volume name you want):

$ sudo newfs_hfs -v "iPod" /dev/diskXs3 
Initialized /dev/rdisk5s3 as a 8 GB case-insensitive HFS Plus volume

Rebooting

Eject the iPod from your Mac:

diskutil eject diskX

Then unplug your iPod, plug it into a power source, and reset it (iPod 3G: hold Menu and Play/Pause).

You should get a progress bar beneath the Apple logo, then the Set Language menu will appear. You’re done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment