Accessing Digital Photography Storage Cards with GNU/Linux

2012-01-12: Note that this article is a bit out of date. If you want to help or have corrections, please email oka AT oka DOT no.

Storage Cards and Reader

Storage cards are used in a variety of electronic devices, including computers and digital cameras. In the world of digital photography, storage cards can be regarded as a kind of digital film. Just like analog film, the storage card is loaded into your camera, and used as a medium to hold images. Like film cartridges, storage cards hold different numbers of pictures, and come in several sizes that fit particular cameras. But unlike film cartridges, storage cards are temporar and reusable.

Each digital camera model is designed to work with a specific kind of storage card. It's important to determine whether the camera accepts a Type I & II, Type III, or Compact Flash card, before you buy a specific card. To find out which type of card works with the camera, check the owner's manual. (Note that some older and/or less expensive digital cameras do not accept storage cards.)

News

2003-03-28: Two articles on the SanDisk ImageMate CF USB storage card reader: Using a Compact Flash Card Reader in Linux and Mounting a USB flash card reader in NetBSD.

2003-03-27: Split this page into three sections: USB Mass Storage Card Readers, IDE Storage Cards and RFC on Digital Film Mount Point.

USB Mass Storage Card readers

  1. Make sure VFAT file system support, USB support, generic SCSI (sg.o) and SCSI disk (sd_mod.o and scsi_mod.o) support is available in your running kernel or loadable through the following modules:
    1. VFAT file system drivers:
      # modprobe vfat
    2. SCSI generic and disk drivers:
      # modprobe sg sd_mod scsi_mod
    3. USB Mass Storage Driver:
      # modprobe usb-storage
    4. To make the usb-storage module load permantly, add this in /etc/modules.conf:
      alias scsi_hostadapter usb-storage
  2. Create a mountpoint:
    # mkdir /mnt/film
  3. Attach the card reader and read the device name (usually /dev/sda1) from dmesg and mount it:
    # mount -t vfat /dev/sda1 /mnt/film
  4. If it does not work, you may already have a SCSI disk installed and assigned to /dev/sda1, so try /dev/sda2, /dev/sdb1, etc.
  5. Access the mountpoint /mnt/film from the shell or an application of your choice.

See Using a USB Compact Flash Reader in Linux by Greg Baker for more complete instructions.

Supported USB Storage Card Readers

SanDisk ImageMate Compact Flash USB (Mullikin)

Visit the at Linux USB Device Overview database for a list of (un)supported USB mass-storage readers.

Visit Using Digital Still Photography Devices with GNU/Linux for details on how to configure USB Mass Storage based digital still photo devices.

IDE Storage Cards

To date, at least three types of PC Cards have been defined by the PCMCIA (Personal Computer Memory Card International Association): Type I & II, Type III, and Compact Flash.

Type I & II, and Type III cards all look like credit cards from the top, with the same length and width, but with different thickness. All have a 3.3-mm thick guide rail around their edges and connector ends, but Type II and III cards are 5 mm and 10.5 mm thick, respectively. In a computer, the guide rails allow the thinner cards to be installed in thicker slots. For example, you can fit two Type I & II cards into a standard PCMCIA slot on a laptop (one card on top of the other); but the same slot will hold only one Type III card.

Type III cards tend to be more fragile than other removable media, because of the rotating heads of their built-in disk drives. However, they can store more data than Type I & II, or Compact Flash cards, which all use solid-state memory. Compact Flash cards are much smaller than the others, and even more durable. That's why they are becoming the standard for many newer digital cameras. You can also use a Compact Flash card on a camera with a Type I & II slot, by first placing the Compact Flash card into an adapter.

The CompactFlash standard for IDE storage cards is maintained and promoted by the Compact Flash Association. According to the web site (http://www.compactflash.org/) there are more than 225 digital still camera models shipping with CF compatible slots (of Type I or Type II).

Some operating systems and cameras require appropriate drivers to be able to read the cards. GNU/Linux systems, however, should not require any special drivers to read standard PCMCIA cards.

First of all, the mount point /mnt/film/ should be available either as a directory or symbolic link, owned by 'root' and a 'film' group.

The mount point should be available to the desktop user that owns /dev/console or just readable to all users on the system.

On GNU systems using the Linux kernel, the syntax in /etc/pcmcia/ide.opts is something like

case "$ADDRESS" in
    *,*,*,1)
    INFO="Compact Flash IDE setup"
    DO_FSTAB="y" ; DO_FSCK="n" ; DO_MOUNT="y"
    FSTYPE="auto"
    OPTS=""
    MOUNTPT="/mnt/film"
    ;;
    *,*,*)
    PARTS="1"
    # Card eject policy options
    NO_CHECK=y
    NO_FUSER=n
    ;;
esac

Supported IDE Storage Cards

According to http://pcmcia-cs.sourceforge.net/ftp/SUPPORTED.CARDS:

Most cards should work fine, including adapters for external IDE devices. Both Flash-ATA cards and rotating-media cards are supported, including "Smartmedia" flash and Compact flash cards.

The very old Western Digital 40MB drives are not supported, because they do not conform to the PCMCIA ATA specification.

RFC on Digital Film Mount Point

In June 2002 I encouraged vendors (on the Free Desktop mailing list) to support auto-mounting of Storage Cards (also called PC Cards) (or more specifically PCMCIA and USB adaptors holding CF cards) and USB mass storage devices that contain digital photography files at /mnt/film/ - the most obvious mount point. This is a simple, unique solution that easily could be implemented coherently by the distributors of free desktop systems, so the desktop application that I'm working on now could access these cards just out of the box.

Mounting Compact Flash USB Card adaptors and USB mass storage devices should be implemented with USB hotplug on Linux-based systems. The following could be in /etc/fstab

/dev/film /mnt/film auto noauto,users,kudzu,rw 0 0

where /dev/film is a symbolic link to the right device (usually /dev/hdc for Compact Flash card readers and /dev/sda1 for USB CF readers and Mass storage devices) set at the point that a user is prompted upon the configuration of "Digital Film".

I want to see a standard way to be implemented everywhere, so application developers don't have to deal with the mess.

Recognition

Randall J. Parr on valhalla-list
Ken Neighbors on debian-user
Uncle Fruities Blob: RedHat 8.0
Justin Ribeiro

References

DCF - Design rule for Camera File System
http://www.pima.net/standards/it10/PIMA15740/dcf.htm
PCMCIA HOWTO -- ATA/IDE fixed-disk device parameters
http://www.linuxdoc.org/HOWTO/PCMCIA-HOWTO.html
Mass Storage Devices
http://www.linux-usb.org/USB-guide/x498.html
Linux 2.4 and USB -- Until Linux USB drivers ship with desktop products, Linux will not rule the desktop
http://www.linuxworld.com/linuxworld/lw-2001-01/lw-01-penguin_3.html
Zaurus: Compact Flash On the Desktop
http://www.zauruszone.com/wiki/index.php?CompactFlash
Linux, Compact Flash Readers, and the HP PhotoSmart 215
http://www.sonic.net/~rknop/linux/hp215.html
SIIG Compact Flash USB Card Reader US2256
http://www.unixgods.org/~tilo/SIIG_compactflash_cardreader.html
External Card Reader for Linux
http://mobilix.org/cardreader_unix.html
Using the ImageMate with Linux
http://www.germane-software.com/~ser/R_n_R/ImageMate.html
Mounting a USB flash card reader
http://www.bsdtoday.com/2002/February/Features638.html

Please notify me, if you are aware of specific storage types or articles.

Thanks

I'd like to thank Simon N Goodwin <simon.at.studio.woden.com>, rupe (from The Yak's Frequently Questioned Answers (mod.2002-02-26)), David M. Burley <khemicals.at.stampede.org> for input, and Richard M. Stallman <rms.at.gnu.org> for his idea of creating this page.


Valid XHTML 1.0 Strict

Last modified: Thu Jan 12 11:24:41 CET 2012

http://www.aamot.org/ole/ole.html
Ole Aamot <oka.at.oka.no>