USB Prodrive on Linux.

Dick Smith Electronics ProDrive XH8054

A Dick Smith Electronics USB ProDrive XH8054. Size: 9cm x 3cm x 2cm.

This is my guide to using a Dick Smith Electronics usb ProDrive under Linux. (Unfortunately, it is not as easy as using the same device under MacOS X.) These useful little devices plug into a usb port, and appear as a disk-drive. I use it to transport files between work and home; While the cheapest model (the 32MB XH8054) is about NZ$20 more expensive than a modem, it is a lot faster and has no running costs. (It would take about four hours to transfer 32MB over a 33.3Kb/s modem, and as I have to commute between home and work anyway the ProDrive is infinitely faster!)

These are a the steps you need to take to get the drive working under Linux.

  1. Create the mountpoint,
  2. Mount the drive,
  3. Create an fstab entry, and
  4. Use Nautilus to mount and unmount the drive.
  5. If you are feeling confident you can also get the drive to mount automatically.

I end with a few optimisations to make working with the drive easier, and an untested method to make use of the mmc card slot in the side of the drive. For the sake of my sanity, I'm going to assume you have a working RedHat 8.0 or 9.0 setup with a standard RedHat kernel so I do not have to tell you to compile anything!

The specific type of drive that I use is the cheapest of all the usb drives that Dick Smith sell, the Dick Smith Electronics USB ProDrive XH8054, which can be purchased on line. However, this page should be applicable to the other models of ProDrive, as they only differ in how much they can store. It should be generally applicable to other solid-state usb mass-storage devices, including the various MP3 players.

Creating the Mountpoint

The first step is to create a mountpoint for the drive. Every drive needs a mountpoint, which is a place in the file-system where the files and folders on the drive appear. To create the mountpoint, open a terminal window, log in as root and type the following.

bash# mkdir /mnt/usbhd

This crates the mountpoint usbhd under the /mnt directory, which is where all mountpoints for removable media are placed.

Mounting the Drive

Mount the drive next. Plug the drive into a free usb port and type the following into the root-terminal you opened earlier.

bash# mount /dev/sda1 /mnt/usbhd

Note: If you already have a scsi hard-disk the name of the drive will be something other than /dev/sda1; possibly /dev/sdb1 or /dev/sdc1 depending on how many hard-disks you already own.

Now test to see if everything worked by copying a file to the drive and unmounting the drive.

bash# cp /etc/fstab /mnt/usbhd
bash# umount /mnt/usbhd

Now remount, and list the files stored on the drive.

bash# ls /mnt/usbhd
bash# mount /dev/sda1 /mnt/usbhd
bash# ls /mnt/usbhd
fstab

I listed the contents of /mnt/usbhd first to prove that the drive was being mounted, and fstab wasn't just sitting in a directory.

Explanation

When the drive is plugged into a port it is assigned to the device sda1, which is the first scsi hard-disk installed on your system. The mount command tells Linux to put the files and folders stored on the first scsi hard-drive under the /mnt/usbhd directory.

You may wonder why the usb drive appears as a scsi hard-disk. It seems that the operating system uses the scsi protocol to talk to the drive, hence the name sda1 (Scsi hard-disk A, Partition 1).

Making Life Easier with fstab

The next step is to reduce typing by adding a line to /etc/fstab, which is the file that tells Linux where to mount the various devices. As root, open /etc/fstab in your favourite editor, and add the following line to the bottom of the file.

/dev/sda1    /mnt/usbhd    msdos    noauto,user,owner,rw 0 0

This allows you to mount the drive by only stating the mount-point, thusly:

bash# mount /mnt/usbhd

You can check to see that it is the drive you mounted earlier.

bash# diff /mnt/usbhd/fstab /etc/fstab
13a14
> /dev/sda1    /mnt/usbhd    msdos    noauto,user,owner,rw 0 0
bash# umount /mnt/usbhd

Making Life Easier with Nautilus

Due to some clever programming in the Nautilus file manager you can use the mouse to mount the usb drive. Right-click on the desktop and select Disks—> usbhd. A hard-drive icon representing the usb drive will appear on the desktop. You can double-click on it, and see all the files in a Nautilus window.

When you are ready to take the drive away, close all programs that are reading files off the drive, right click on the hard-drive icon and select Unmount Volume.

(If you were wondering, Nautilus looks in /etc/fstab for all lines containing the word user and adds the name of the device to the Disks menu.)

Mounting the Drive Automatically

Users of MacOS X and Windows would be aware that usb drives are automatically mounted when they are plugged in. Unfortunately this takes a bit of effort to get working under Linux.

  1. First, download this program.
  2. As the root-user, copy the program into the /etc/hotplug/usb directory, making sure that the program is still called usb-storage.
  3. Make the program executable by running the following command.
    bash# chmod 755 /etc/hotplug/usb/usb-storage
  4. Try plugging in your drive. If it does not mount automatically you will need to reboot the computer.

You cannot just unplug the drive when you have finished. You must unmount the drive — as we did before — when you have finished.

Explanation

When a device is is plugged in the kernel runs a script called hotplug, which then runs one of the scripts held in the appropriate /etc/hotplug directory. These scripts are are named after the types of usb devices; when a device of that type is plugged in, the appropriate script is run.

The usb-storage script does three things. Firstly, it determines who the current user is, using code found in the usbcamera script. Second, the drive is mounted as the current user. Finally, another script is created to clean-up when the drive is unplugged. You can read the script if you want more detail.

Optimisations

The first (and currently the only) optimisation to make is to change the file system from the default msdos, which can only handle eleven-character filenames, to vfat. In theory you could use any file system, but vfat can handle long names, and it can be read by most systems. To change the file system, unmount the drive, and type the following command in as root.

bash# mkfs -tvfat /dev/sda1

This will wipe all data off the drive, but all new files written to the drive will have long filenames. Now you will have to change the entry for the drive in /etc/fstab so mount uses vfat instead of msdos.

/dev/sda1    /mnt/usbhd    vfat    noauto,user,owner,rw 0 0

MMC & SD Ram

If you look carefully at the side of the ProDrive you will notice a small slot. This allows a small Secure Digital or MMC card to be read by the ProDrive. I have it on reasonable authority that Linux can happily read the card, but I have not tried this out.

To allow the card to be read, you apparently have to add the following line to /etc/modules.conf.

options scsi_mod max_scsi_luns=2

The line allows two scsi devices to use the same cable, which they cannot normally do under RedHat. To get the line to work you will have to reload the scsi_mod kernel module, but it is easier to restart you computer.

After the restart create a new mountpoint, such as /mnt/mmchd, plug in the mmc or sd card and mount the /dev/sdb1 device.