Mounting on Linux

From wikiPodLinux

Table of contents

Required

  • Your iPod must be Windows formatted for these methods of mounting to work.

If you have a Mac formatted ipod, formatted by MacOS *classic*, Read the gentoo-wiki article in the links section

FireWire

Configure your kernel

# cd /usr/src/linux
# make menuconfig

Then toggle to:

Device Drivers/IEEE 1394 (FireWire) support/
Image:Firewire_setup.png

You need to have these modules included in your kernel:

  • IEEE 1394 (FireWire) support
  • OHCI-1394 support
  • SBP-2 support

A few host adapters need PCILynx instead of OHCI. If unsure, build both. It is recommended, though not strictly necessary, to build all FireWire drivers as modules.

Locating your iPod

Under Linux you should check the file "/proc/scsi/scsi" for an entry where the Vendor is "Apple" and the model is "iPod". For example:

# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: Apple Model: iPod Rev: 1.50
Type: Direct-Access ANSI SCSI revision: 02

The scsi0 portion indicates the iPod is the first SCSI device and so will most probably be visible as /dev/sda, if on your system you see scsi1 then your iPod would probably be using device /dev/sdb. The following example commands will use sda as the device for the iPod, please replace this with the correct device for you configuration.

Mounting

After you have your kernel all set up and SBP-2 is a module, load the SBP-2 module:

# modprobe sbp2

Then mount your iPod's data partition and root partition (not the boot partition):

# mount -t vfat /dev/sda2 /mnt/ipod
# mount -t ext3 /dev/sda3 /mnt/ipod_root
panasonic plasma tv


Unmounting

There are three alternative ways. The first one is the easiest.

a) Send an eject command. This will unmount all partions of the iPod, and the "safe to disconnect" checkmark will appear on the iPod.

# eject sda

Beware, this command may cause some kernel versions too panic or oops. This bug has been fixed in Linux 2.6.14.5 and later.

b) If you cannot use the eject command, unload the sbp2 module to get the checkmark. Before that, unmount all partitions of the iPod:

# umount /mnt/ipod
# umount /mnt/ipod_root
# modprobe -r sbp2

c) If you cannot unload sbp2 because there are other SBP-2 devices in use, detach sbp2 only from the iPod:

# umount /mnt/ipod
# umount /mnt/ipod_root
# echo 1 > /sys/bus/ieee1394/devices/${ipodguid}-0/ignore_driver
# echo 0 > /sys/bus/ieee1394/devices/${ipodguid}-0/ignore_driver

The last command is necessary to access the iPod again when plugged in again later. The proper ${ipodguid} can be found by checking */vendor_name_kv or */model_name_kv in /sys/bus/ieee1394/devices/.

USB

Configure your kernel

# cd /usr/src/linux
# make menuconfig
 Device Drivers> USB support:
   <*> Support for Host-side USB
     <M> UHCI HCD (most Intel and VIA) support
   <*> USB Mass Storage support
 Device Drivers > SCSI device support:
   <*> SCSI device support
     [*] legacy /proc/scsi/ support
     <*> SCSI disk support

UHCI HCD must be compiled as a module (named 'uhci_hcd') because loading and unloading this is what enables you to "mount" and "unmount" your iPod.


Locating your iPod

(same as FireWire)

Under Linux you should check the file "/proc/scsi/scsi" for an entry where the Vendor is "Apple" and the model is "iPod". For example:

# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: Apple Model: iPod Rev: 1.50
Type: Direct-Access ANSI SCSI revision: 02

The scsi0 portion indicates the iPod is the first SCSI device and so will be visible as /dev/sda, if on your system you see scsi1 then your iPod would be using device /dev/sdb. The following example commands will use sda as the device for the iPod, please replace this with the correct device for you configuration.


Mounting

After you have your kernel all set up and UHCI HCD is a module, load the UHCI HCD module:

# modprobe uhci_hcd

Then mount your iPod's data partition and root partition (not the boot partition):

# mount -t vfat /dev/sda2 /mnt/ipod
# mount -t ext3 /dev/sda3 /mnt/ipod_root


Unmounting

Unload the UHCI HCD module so that you get that checkmark on your iPod:

# rmmod uhci_hcd

Unmount the paritions:

# umount /mnt/ipod
# umount /mnt/ipod_root


Troubleshooting

If your connecting your ipod to linux through USB, you might be getting some problems:

 #fdisk /dev/sda (or whichever device ipod should be)
  Unable to read /dev/sda
 #dmesg | grep sda
  sda: I/O error: dev 00:00, sector 78126040 (or something along these lines)

To fix this, you will have to recompile your kernel without EFI support. When building the kernel, set CONFIG_EFI_PARTITION=n.

This should fix the problem.



Also, you may find that you come across other errors when trying to mount a Windows formatted iPod under linux, such as this:

 Sep  7 14:10:00 denmark kernel: Unable to load NLS charset ascii
 Sep  7 14:10:00 denmark kernel: FAT: IO charset ascii not found

You can fix this two ways, I choose the first because it was easier to use as I compiled VFAT support as a module in my kernel. USE THIS AT YOUR OWN RISK From the kernel Documentation/filesystems/vfat.txt:

 NOTE: "iocharset=utf8" is not recommended.

Having said that, its all that worked on my box.

 1) Get into your kernel config and change the option
 File Systems--->
    DOS/FAT/NT Filesystems--->
      <M>VFAT (Windows 95) fs support
       (ascii) Default iocharset for FAT
 Simply change ascii to read "utf8," without the quotes, of course.
 2) You can change the charset when mounting by passing the option iocharset=<CHARSET>, such as:
 #mount -t vfat -o iocharset=utf8 /dev/sda2 /mnt/ipod
 3) The suggested 'safe' method for doing this, however, is:
 #mount -t vfat -o utf8=true /dev/sda2 /mnt/ipod

I hope this helps someone in my situation.

Bash Scripts

Mount

#!/bin/bash
#
modprobe uhci_hcd
modprobe sbp2
(sleep 1 && mount -t vfat /dev/sda2 /mnt/ipod) &
(sleep 1 && mount -t ext3 /dev/sda3 /mnt/ipod_root) &
echo "iPod mounted"


Unmount

#!/bin/bash
#
modules=`awk '{if ($1 == "uhci_hcd") print $1, " "}' /proc/modules`
modules=$modules `awk '{if ($1 == "sbp2") print $1, " "}' /proc/modules`

umount /mnt/ipod
umount /mnt/ipod_root

#disable the modules
rmmod $modules

echo "Remove the iPod then press <ENTER>."
read

#re-enable the modules
modprobe $modules