Using an iPod mini with Linux

N.B: This page is no longer actively maintained. These instructions were writen around 2005, when the iPod mini model was introduced (now deprecated). While the info here is supposed valid for newer iPod models, I haven't checked it. If you find any discrepancies please contact me

by Pedro Diaz


This page is aimed to Linux users who would like to use their iPods under Linux. This is not a page about installing Linux on the iPod (look here for that).

Although I am pretty sure that most of the information on this page is applicable to every iPod in spite of its generation and size format (normal, mini, photo), this page has been written with an iPod mini in mind. Your mileage may vary with other iPods but, as I said, this is unlikely.

I will assume some Linux administration knowledge; being comfortable compiling a kernel or installing packages are prerequisites here.

Before you start: know your iPod

iPods come in two flavors, regardless the model: Mac and PC. On both cases the hardware and firmware inside them is identical. What varies among flavors is how the hard disc is partitioned and formatted; Mac models come with Mac-style partitions and HFS+ filesystems whereas PC models come partitioned PC-style and with VFAT filesystems. There are also some iPods marked as "Mac+PC", but actually they are Mac iPods shipped also with Windows software that can convert a Mac iPod to a PC iPod.

The flavor of your iPod should be shown on its packaging. If you don't have it or you are lazy enough to not care just proceed as if it was a PC iPod and see if you have any problems making Linux detect it (explained below); if yes then chances are that you have a Mac iPod.

If you do have a Mac iPod (or a Mac+PC, for that matter) you will have to make a decision: do you want to convert it to a PC iPod?. From the point of view of using it with Linux, it does not matter because recent kernels (i.e.: 2.6.x) have good support for Mac partitions and HFS+ filesystems. But the iPod can also be used as a portable hard disk and therefore it could be useful to convert it to a PC iPod, since VFAT is more widely supported than HFS+. Anyways, since converting a Mac iPod to a PC iPod is not trivial (no difficult) you might want to try it first without any nasty conversion procedure.

Making Linux talk with your iPod

Common configuration for Mac and PC iPods

The first thing you do to use your iPod under Linux is to configure the kernel to recognize your iPod. Try to use a recent kernel (2.6.x), specially if you have a Mac iPod (I believe that 2.4.x kernels do not have HFS+ write support). I am using kernel 2.6.10.

My iPod (mini, Mac+PC) came with two different cables for plugging it to Firewire and USB ports. I don't know if other models also come with an USB adapter, but anyways I will explain here how to configure the kernel to support both:

The iPod is not different from other external hard drives, so if you have one of those already running under Linux (and using the same bus interface as you pretend for your iPod) probably you won't have to recompile the kernel. Check that you have the above options in your current kernel, though (hint: zcat /proc/config.gz).

Mac iPod owners need also a couple of additional options in their kernels. If you have a PC iPod then skip the following subsection

Mac iPod specifics

If you are running Linux on any platform other than a Mac then your will probably have to configure your kernel to "understand" Mac-style hard discs. Don't worry, this is as easy as selecting the following options in the kernel:

Mounting the iPod

Once you have a kernel that support the needed options, you will see kernel messages when you plug your iPod that indicate that the iPod has been detected. (if you compiled as a module, remember to insmod the modules!):
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 7
usb-storage: waiting for device to settle before scanning
  Vendor: Apple     Model: iPod              Rev: 1.61
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sda: 7999488 512-byte hdwr sectors (4096 MB)
sda: assuming Write Enabled
sda: assuming drive cache: write through
SCSI device sda: 7999488 512-byte hdwr sectors (4096 MB)
sda: assuming Write Enabled
sda: assuming drive cache: write through
 sda: [mac] sda1 sda2 sda3
Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0
usb-storage: device scan complete
This messages correspond to a Mac iPod (mini) connected through USB 2.0. If you used Firewire or you have a PC iPod the messages will probably differ, but the bottom line is that at the end some new SCSI devices will be detected (in the above example, sda1, sda2, sda3).

Mac iPods have three partitions and PC iPods have two. The mountable partition in Mac iPods is the third one (i.e.: sda3 if sda is the whole iPod disc); the second one contains the firmware and the first one is used for some kind of partition map (I don't know exactly what it is). In PC iPods the first partition contains the firmware and the second one the FAT32 filesystem.

The only thing left before transferring your music is to mount the iPod drive. With my Mac+PC iPod mini this is done with the following command: mount -t hfsplus /dev/sda3 /media/ipod/

That's all, from this point on you can use your iPod as a portable hard drive!

Transferring music to your iPod

Just copying your music files to the iPod won't be enough to play them. In order to allow your iPod to find your music files, a special database (iTunesDB) needs to be updated. This step is usually done on Windows and Mac systems with the iTunes software, but unfortunately there is not a Linux version of iTunes (ask Apple!; the more request they get, the more likely they port iTunes to Linux).

But don't worry!. There are some Linux programs out there that will do the job just fine. In the past I've used command line clients, being tyhe best one (in my opinion) GNUpod, but right now I prefer to use a GUI aplication. gtkpod is a good graphical alternative; in the past it had some stability issues but recent versions seem to have solved this problem.

Here is a screenshot of gtkpod:

gtkpod screenshot

amaroK, KDE's music player, has also built-in ipod support. I have not tried it yet so I can't comment on this.

Appendix: Converting a Mac iPod to a PC iPod

Converting a Mac iPod to a PC one is not very difficult, but involves some delicate steps. Of course, you can always plug your iPod into a Windows machine and let iTunes do it ; but hey!, where is the fun in that?.

An optional step you might want to perform before continuing is checking that your partition layout is similar as mine. To do so you have to install the parted utility, because fdisk does not read Mac-style partitions. On my iPod mini (sda) the layout is the following:

# parted /dev/sda
GNU Parted 1.6.11 with HFS shrink patch 12.5
Copyright (C) 1998 - 2004 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

Using /dev/sda
Information: The operating system thinks the geometry on /dev/sda is 1024/126/62.
(parted) print
Disk geometry for /dev/sda: 0.000-3906.000 megabytes
Disk label type: mac
Minor    Start       End     Filesystem  Name                  Flags
1          0.000      0.030              partition map
2          0.031     32.030              firmware
3         32.031   3905.999              disk
(parted) q
Of course, if you have a different kind of iPod the numbers will differ. Anyways, just check that, like in my case, sda2 is a 32MB partition named "firmware". If not, Apple might have changed the layout of the partitions on your iPod and the instructions below may not be valid!

The procedure is the following:

  1. The iPod's firmware is identical in the PC and Mac versions of the gadget. Backup the partition containing the firmware of the iPod:
    # dd if=/dev/sda2 of=backup_firmware
    65536+0 records in
    65536+0 records out
    33554432 bytes transferred in 5.767869 seconds (5817475 bytes/sec)
    # du -hs backup_firmware
    33M     backup_firmware
  2. This is the "scary" part: destroy the current partition layout and reload the usb_storage or sbp2 module to "flush out" the Mac partition layout:
    # dd if=/dev/zero of=/dev/sda bs=1M count=10
    10+0 records in
    10+0 records out
  3. Create a new, PC-style partition table with fdisk (user input in red and underlined):
    odiel:/dev# fdisk /dev/sda
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel. Changes will remain in memory only,
    until you decide to write them. After that, of course, the previous
    content won't be recoverable.
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    Partition number (1-4): 1
    First cylinder (1-1024, default 1):
    Using default value 1
    Last cylinder or +size or +sizeM or +sizeK (1-1024, default 1024): +34M
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    Partition number (1-4): 2 
    First cylinder (11-1024, default 11):
    Using default value 11
    Last cylinder or +size or +sizeM or +sizeK (11-1024, default 1024):
    Using default value 1024
    Command (m for help): p
    Disk /dev/sda: 4095 MB, 4095737856 bytes
    126 heads, 62 sectors/track, 1024 cylinders
    Units = cylinders of 7812 * 512 = 3999744 bytes
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1          10       39029   83  Linux
    /dev/sda2              11        1024     3960684   83  Linux
    Command (m for help): t
    Partition number (1-4): 1
    Hex code (type L to list codes): 0
    Type 0 means free space to many systems
    (but not to Linux). Having partitions of
    type 0 is probably unwise. You can delete
    a partition using the `d' command.
    Changed system type of partition 1 to 0 (Empty)
    Command (m for help): t
    Partition number (1-4): 2
    Hex code (type L to list codes): b
    Changed system type of partition 2 to b (W95 FAT32)
    Command (m for help): p
    Disk /dev/sda: 4095 MB, 4095737856 bytes
    126 heads, 62 sectors/track, 1024 cylinders
    Units = cylinders of 7812 * 512 = 3999744 bytes
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1          10       39029    0  Empty
    /dev/sda2              11        1024     3960684    b  W95 FAT32
    Command (m for help): w
    The partition table has been altered!
    Calling ioctl() to re-read partition table.
    WARNING: If you have created or modified any DOS 6.x
    partitions, please see the fdisk manual page for additional
    Syncing disks.
    Note that the first partition has been set to type 0; ignore the warning given by fdisk
  4. Restore the firmware from the backup made in the first step
    # dd if=backup_firmware of=/dev/sda1
    65536+0 records in
    65536+0 records out
    33554432 bytes transferred in 39.224540 seconds (855445 bytes/sec)
  5. Create a FAT32 filesystem on the second partition:
    # mkfs.vfat -F 32 -n "My iPod" /dev/sda2
    mkfs.vfat 2.10 (22 Sep 2003)
  6. Reset the iPod by pressing Menu and Play for 5 seconds
  7. That's it!. Check that the iPod powers on and that everything looks normal. Try to mount it (remember, now it is sda2!). Try to add some songs (with GNUpod for example). Everything should look and feel normal


TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones