SanDisk ImageMate Dual Reader

by Steve R. Hastings

SanDisk ImageMate Dual Reader

My digital camera probably works well with GPhoto, but I've never tried it. I find it more convenient to use a Flash card reader.

The SanDisk ImageMate Dual Readers are a line of external USB Flash card readers with two slots, able to read two different Flash card formats. Three ImageMate Dual Reader models are available: CompactFlash and SD/MMC card, CompactFlash and SmartMedia and CompactFlash and Memory Stick. Only CompactFlash Type 1 is supported.

The ImageMate Dual Readers are compact, with a short USB cable that can be stored completely inside the reader. They also come with a USB extension cable. For typical desktop use, you probably would use the USB extension cable. But the short cable tucked inside the reader might be convenient when traveling with a laptop.

My ImageMate Dual Reader is an SDDR-73, with CompactFlash and SD/MMC card slots. I got it working under Linux, and it's unexciting--it simply works. In the rest of this article I describe how to set up an SDDR-73, but the instructions should work equally well for the other models.

Setting Up Kernel Modules

If you use a Linux distribution that provides a precompiled kernel, you already may have a kernel setup that works with the ImageMate. If so, you can skip this section. If not, read on.

You need several modules in your kernel, either compiled in or loaded before you use the card reader. From the SCSI support section:

  • SCSI Support (CONFIG_SCSI, scsi_mod.o)

  • SCSI disk support (CONFIG_BLK_DEV_SD, sd_mod.o)

  • SCSI generic support (CONFIG_CHR_DEV_SG, sg.o)

  • Probe all LUNs on each SCSI device (CONFIG_SCSI_MULTI_LUN) enabled.

from the Filesystem section:

  • DOS FAT fs support (CONFIG_FAT_FS, fat.o)

  • MSDOS fs support (CONFIG_MSDOS_FS, msdos.o)

  • VFAT (Windows-95) fs support (CONFIG_VFAT_FS, vfat.o)

from the USB support section:

  • Support for USB (CONFIG_USB, usbcore.o)

  • USB drivers for your computer; one or more of:

    • ECHI HCD (CONFIG_USB_EHCI_HCD, ehci-hcd.o)

    • UHCI (CONFIG_USB_UHCI, usb-uhci.o)

    • OHCI (CONFIG_USB_OHCI, usb-ohci.o)

  • USB Mass Storage support (CONFIG_USB_STORAGE, usb-storage.o)

Setting Up Your System

The ImageMate is recognized as a USB storage device. The Linux kernel treats USB storage devices as SCSI devices, so it is assigned a device of /dev/sdx, where x is a letter from a to z. My system has no SCSI devices, so the ImageMate is assigned to the first SCSI drive, /dev/sda. But it's also to /dev/sdb, because the CompactFlash card slot is assigned to one SCSI device, and the SD/MMC card slot is assigned to a second.

For this all to work correctly, your SCSI subsystem must have been compiled with the option to Probe all LUNs on each SCSI device (CONFIG_SCSI_MULTI_LUN) enabled. LUNs, or logical unit numbers, are a way for a single device to be treated as multiple devices. If the Probe all LUNs option is set to false, only the first slot in the reader (the CompactFlash) will actually work.

To tell which SCSI drive your ImageMate is assigned to, simply look at your system log files. The kernel log should have messages about this, and if you boot with the ImageMate attached, the dmesg command also will show the information.

I suggest you create abstract names for the card reader in /dev. You should have a name for each card slot device, for example:

# ln -s /dev/sda1 /dev/cf
# ln -s /dev/sdb1 /dev/mmc

You need to state /dev/sda1 rather than /dev/sda; otherwise, the mount command will fail with this message:

mount: wrong fs type, bad option, bad superblock on /dev/sda,
       or too many mounted file systems

The actual problem is none of these things; it's simply that you didn't specify which partition to mount. /dev/sda1 specifies the first partition. (On a Flash card, there is probably only a single partition.)

Next add the following lines to your /etc/fstab file:

/dev/cf         /mnt/cf         vfat    rw,user,noauto          0 0
/dev/mmc        /mnt/mmc        vfat    rw,user,noauto          0 0

With these lines in place, you can mount a CompactFlash with:

mount /mnt/cf

Be sure to unmount it before removing the Flash card:

umount /mnt/cf

When you add the mount points to /etc/fstab, you can mount a Flash card easily from a GNOME 2.x desktop. Simply right-click on the desktop, choose Disks from the menu and choose the Flash device you wish to mount.

In KDE, you need to create an icon for each of the Flash readers' slots. Instructions on how to do this are available here.

I paid about $30 for my ImageMate, and I am very satisfied with it. Getting it to work under Linux was easy, and it is working well.

The Care and Feeding of Flash Cards

Flash cards don't last forever, but here are a few tips on how to take care of them so they can last longer.

Any given sector on a Flash chip can be written to only a certain number of times. Although this number is quite high (hundreds of thousands of writes, at least), some parts of the Flash card are written to rather frequently, specifically, the file allocation table (FAT).

Most Flash cards are formatted using the FAT filesystem. The FAT itself, where files are allocated, is written to multiple times whenever you write or delete a file. If you delete a hundred files, you must write to the FAT at least a hundred times. For this reason, when I wish to wipe clean my camera's Flash cards, I usually don't delete the files. Instead, I use the camera's Format feature, which gets rid of all the photos with minimal writes to the chip. (Of course, if you want or need to leave some photos in place while deleting others, go ahead.) For the same reason, if you have many small files you wish to save on a Flash card, it is best to bundle them into a tar file first.

If you have a device such as a camera that uses Flash cards, you probably should use that device to format the Flash card. If you want to format under Linux, be quite sure to use the same format the device expects. For example, my camera expects FAT16 on a Flash card; if I were to format it as FAT32, the card would not work in my camera. You can use the minfo command from the MTools package to find out how a Flash card was formatted. This command tells you the exact mformat command line you need to use to format another card in the same manner. If you are formatting a card purely for use with Linux systems, you can use any legal filesystem (such as ext2).

Sometimes the Flash card may develop a bad sector. For example, during my last vacation I discovered that my camera would hang with one particular CompactFlash card when it was three-quarters full. I suspected a bad sector. I formatted it under Windows with Bad Sector Scan enabled, after which it again worked reliably. The Linux equivalent would be to run the mbadblocks program from the MTools package; this finds bad blocks and marks them bad in the FAT. However, in my testing with my ImageMate, I have found that mbadblocks hangs before completing its check of a Flash card. I am going to contact the MTools maintainers and see if mbadblocks can be made to work correctly. For now, assume it doesn't work.

Steve Hastings first used UNIX on actual paper teletypes. He enjoys bicycling, music, petting his cat and making his Linux computers do new things.

Load Disqus comments