Advertisement

hacksugar: Working with iPad-mounted USB drives

Recently, TUAW has looked at using the iPad's camera connection kit to attach and use USB drives. If you're using a jailbroken iPad, you'll be pleased to discover that the camera connection kit allows you to connect a USB stick or hard drive and access it from your iPad. That means you can easily bring extra files on-the-go and copy them into third party (i.e. no, you're not going to update your iTunes library on the go...yet) applications.

Mounting drives is the province of a built-in application called MobileStorageMounter. It's part of the iPad's core services. When it sees a new FAT or HFS USB device, it attempts to mount that device using standard Unix services. If it finds a built-in DCIM folder on the drive, it launches the iPad Photos application. If not, it throws up the dialog shown at the top of this post, reporting that the attached USB device is not supported.

As far as you're concerned, that error message is good news. It means that the device has been properly mounted and is ready for use. If you do not see the dialog, it's time to take one of two courses of action: a quick fix that works most of the time and a thorough fix that always works.

Read on to learn more...




To use the quick fix, you'll need access to the iPad command line, so install OpenSSH. (Make sure to change your password once you do, to avoid those rotten little exploits that have been floating around for the last few months.) Then connect via an ssh connection, either from your computer or via the fabulous iSSH application. iSSH costs $9.99 at the App Store. I looked at iSSH as a VNC client last week but that overview didn't highlight the utility's basic strength, i.e. connecting to secure shell sessions.

To connect via iSSH, create a new configuration. Set the host to 127.0.0.1 (i.e. the local iPad), set the login to "root" and the password to your normal account credentials. Leave the command option blank. When you connect, iSSH puts you right at the iPad command line -- very handy.

Once you're at the command line, either through your computer's ssh session or via iSSH, issue the following command:

killall "MobileStorageMounter"

This kills the running MobileStorageMounter process, and immediately a new process is spawned. When it starts running, it automatically checks for any attached devices and mounts them. This solution works about 80% of the time.

If you do not quickly (within 5-10 seconds) see the "device not supported" error message, try again. If two or three attempts fail, you may have to switch to the backup strategy, namely rebooting your system. The easiest way to do this is to enter reboot at the command line. Keep the USB drive inserted into the camera connection kit. Upon rebooting, the mounter should recognize and mount it, displaying the "device not supported" message when you unlock the screen.

To identify what items are mounted on your system, enter the mount command at the command line. This returns a list of devices and their mount points. Your primary USB drive is normally /dev/disk1s1, and is mounted in the /var/mnt/ folder. The mount command will specify the exact subfolder for that mount point.

You can use standard Unix command to copy files from the drive into an application Documents folder. However, keep in mind that App Store apps have limited permissions. You'll need to chown those copied files from "root" ownership to "mobile." Otherwise, the items will not be usable by applications.

Some USB devices will not properly mount on the system. These are generally high powered devices such as USB-based Flip-like video cameras. I have been unable to access storage on these cameras, even when using a powered hub in response to the "Accessory Unavailable. The attached accessory uses too much power" system error message. You can, however, connect more than one USB device at a time by using hubs. I have connected multiple keyboards, drives, etc. using both powered and unpowered hubs without any problem.

Should you need to unmount a device, without physically removing it, you can use the standard umount Unix command. Pass it the device path, e.g. /dev/disk1s1 as an argument. You can also use fsck to check the drive's file system consistency.

USB drive support offers a handy way to carry extra files around, especially if you bought one of the more restricted iPad sizes, such as the 16GB model. No, you cannot use this to extend your media library (yet... although someone is sure to be working on that already) but you can use this feature to copy files from and to your iPad while on the go using a standard USB thumb drive, a jailbroken iPad (thanks, Comex), and the USB dongle from the iPad camera connection kit.

Got more ways to manage or use USB drives with your iPad? Let us know in the comments.