How to use a flash card reader with Linux

Posted in Linux/Unix/BSD -

I bought an external USB 2.0 7 in 1 flash card reader that supports the following media types: compact flash card, ibm microdrive, smart media card, multimedia card, secure digital card memory stick card and memory stick pro card flash. I'm using SuSE Linux Professional 9.0 on a Compaq EVO N1020v notebook and was hoping just plugging it in and shoving my 512MB Type 1 flash card would work but alas not.

After doing some Googling I found the answer in their "Groups" search and managed to get the card reader mounted. This worked for me and it may or may not work for you. If you follow the instructions here and it doesn't work for you but you manage to work it out, I'd love to hear your solution and will update this article accordingly.

As I noted in the first paragraph I'm using SuSE Linux, but the information in this article should (hopefully) apply to all modern Linux distributions.

/var/log/messages Error Message

After plugging the card reader into my laptop the following stuff appeared in the /var/log/messages file:

Mar 24 16:08:22 laptop kernel: hub.c: new USB device 00:13.2-1, assigned address 10
Mar 24 16:08:22 laptop kernel: WARNING: USB Mass Storage data integrity not assured
Mar 24 16:08:22 laptop kernel: USB Mass Storage device found at 10
Mar 24 16:08:26 laptop kernel: sda : READ CAPACITY failed.
Mar 24 16:08:26 laptop kernel: sda : status = 1, message = 00, host = 0, driver = 08
Mar 24 16:08:26 laptop kernel: Current sd00:00: sense key Not Ready
Mar 24 16:08:26 laptop kernel: Additional sense indicates Medium not present
Mar 24 16:08:26 laptop kernel: sda : block size assumed to be 512 bytes, disk size 1GB.
Mar 24 16:08:26 laptop kernel: sda: test WP failed, assume Write Enabled
Mar 24 16:08:26 laptop kernel:   sda: I/O error: dev 08:00, sector 0
Mar 24 16:08:26 laptop kernel:   I/O error: dev 08:00, sector 0
Mar 24 16:08:26 laptop kernel:   I/O error: dev 08:00, sector 2097144
Mar 24 16:08:26 laptop kernel:   I/O error: dev 08:00, sector 2097144
Mar 24 16:08:26 laptop kernel:   I/O error: dev 08:00, sector 0
Mar 24 16:08:26 laptop kernel:   I/O error: dev 08:00, sector 2
Mar 24 16:08:26 laptop kernel:   I/O error: dev 08:00, sector 0
Mar 24 16:08:26 laptop kernel:   unable to read partition table
Mar 24 16:08:26 laptop kernel: Device not ready.   Make sure there is a disc in the drive.

and so on and so on and so on. After the initial few screenfuls of errors it stopped so I plugged the flash card into the card reader. No error messages. Unplugged the card reader and got a disconnect message and then more of the above stuff. Left the card in and plugged it back in and more of the above stuff. But no way to actually access the data on the card.

How to mount the flash card

So I went searching through Google and found out that all you need to do is check the /etc/fstab file and the appropriate entry will be there (duh! why didn't I think of that?). Sure enough, my /etc/fstab file now had the additional entry in it as appears below. Note that it may take a few seconds after plugging the card reader in for the entry to appear in the /etc/fstab file.

/dev/sda1 /media/sda1 auto sync,noauto,user,exec 0 0 #HOTPLUG B3Fu.Ua5HXb3bf0A

This tells me the device is at /dev/sda1 and that it will be mounted at /media/sda1. The exact device name and mount location may vary depending on your distribution and hardware (eg it might be /dev/sdb1 /dev/sdc1 /dev/sdd1 or something completely different). So all I needed to do now was run

mount /dev/sda1
or
mount /media/sda1

and the data on the flash card is accessible at /media/sda1. This can be run as yourself, ie you do not need to be logged in as root to mount the flash card. Remember to unmount the card before unplugging the card reader or removing the flash card to avoid data loss using the umount command.

Dick Smith Electronics 7 in 1 Card Reader

Incidentally the card reader I bought was from Dick Smith Electronics (DSE) but I can't link directly to the product page on their website otherwise it takes you back to the homepage due to the way the Intershop system they use deals with sessions. You can view it on a search results page here but if the product is discontinued at any time then this link will give you a "product not found" type of error message.

This is a picture of it, without the flash card plugged in (it was in the digital camera taking the photo...)

DSE 7 in
1 flash card reader

Related pages

How to scan the SCSI bus to determine the device name and number.




Comments