How to rescan a USB card reader

When you plug in a USB card reader, a number of devices will be added (depending on the number of cards supported by the reader). Looking at dmesg output after plugging in the reader...

usb 1-2.1: new high speed USB device using ehci_hcd and address 13
usb 1-2.1: configuration #1 chosen from 1 choice
scsi9 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 13
usb-storage: waiting for device to settle before scanning
  Vendor: Generic   Model: USB SD Reader     Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
sd 9:0:0:0: Attached scsi removable disk sdb
  Vendor: Generic   Model: USB CF Reader     Rev: 1.01
  Type:   Direct-Access                      ANSI SCSI revision: 00
sd 9:0:0:1: Attached scsi removable disk sdc
  Vendor: Generic   Model: USB SM Reader     Rev: 1.02
  Type:   Direct-Access                      ANSI SCSI revision: 00
sd 9:0:0:2: Attached scsi removable disk sdd
  Vendor: Generic   Model: USB MS Reader     Rev: 1.03
  Type:   Direct-Access                      ANSI SCSI revision: 00
sd 9:0:0:3: Attached scsi removable disk sde
usb-storage: device scan complete

In this case, devices /dev/sdb, sdc, sdd and sde have been added. However, if there were no cards in the reader when you plugged it in, there will be no devices present that allow you to mount, hence access, the card.

steph@slap ~ $ mount /mnt/sdb1
mount: can't find /mnt/sdb1 in /etc/fstab or /etc/mtab

If there was a card in the reader when you plugged it in, e.g. in the first slot, then it would be available via /dev/sdb1.

So, how do you rescan the device so that you don't have to plug in the card reader every time you want to add/remove a card?...

Use hdparm to rescan the appropriate device:

hdparm -z [device]

hdparm is normally only usable by superusers (it's normally located at /sbin/hdparm), so you'll either have to log in as a superuser or run the command via sudo. e.g:

steph@slap ~ $ sudo hdparm -z /dev/sdb

/dev/sdb:
 re-reading partition table

dmesg will show something like the following:

SCSI device sdb: 7959552 512-byte hdwr sectors (4075 MB)
sdb: Write Protect is off
sdb: Mode Sense: 03 00 00 00
sdb: assuming drive cache: write through
 sdb: sdb1

You should now be able to mount the card.

Last modified: 27/09/2008 Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top