Usually modern desktop Linux distributions make it easy to automatically mount external storage media like USB flash sticks. But if all else fails this article may help you.
Kernel
Compile a kernel with SCSI disk support (CONFIG_BLK_DEV_SD), multiple LUN support (CONFIG_SCSI_MULTI_LUN – otherwise the x-in-1 card reader will not work) and USB storage support (CONFIG_USB_STORAGE).
Plug it in
Plug the device/flash card in and watch your syslog. It should show something like:
May 12 19:09:57 aldi kernel: usb 2-1: new full speed USB device using address 5 May 12 19:09:57 aldi kernel: scsi5 : SCSI emulation for USB Mass Storage devices May 12 19:09:57 aldi kernel: Vendor: MATSHITA Model: DMC-FZ20 Rev: 0100 May 12 19:09:57 aldi kernel: Type: Direct-Access ANSI SCSI revision: 02 May 12 19:09:57 aldi kernel: SCSI device sde: 246017 512-byte hdwr sectors (126MB) May 12 19:09:57 aldi kernel: sde: assuming Write Enabled May 12 19:09:57 aldi kernel: sde: assuming drive cache: write through May 12 19:09:57 aldi kernel: sde: sde1 May 12 19:09:57 aldi kernel: Attached scsi removable disk sde at scsi5, channel0, id 0, lun 0 May 12 19:09:57 aldi kernel: Attached scsi generic sg4 at scsi5, channel 0, id 0, lun 0, type 0 May 12 19:09:57 aldi kernel: USB Mass Storage device found at 5 May 12 19:09:57 aldi udev[6641]: creating device node '/dev/sg4' May 12 19:09:57 aldi udev[6624]: configured rule in '/etc/udev/rules.d/z_hal-plugdev.rules[2]' applied, 'sde' becomes '%k' May 12 19:09:57 aldi udev[6624]: creating device node '/dev/sde' May 12 19:09:57 aldi udev[6658]: configured rule in '/etc/udev/rules.d/z_hal-plugdev.rules[2]' applied, 'sde1' becomes '%k' May 12 19:09:57 aldi udev[6658]: creating device node '/dev/sde1' May 12 19:09:57 aldi scsi.agent[6666]: sd_mod: can't be loaded (for disk)
You can see what kind of device was detected and that udev has created device nodes /dev/sg4, /dev/sd3 and /dev/sde1 which you could mount. Or better: let the system tell you the partition schemes on the devices:
$> fdisk -l /dev/sde1 Disk /dev/lumix: 125 MB, 125960704 bytes 8 heads, 32 sectors/track, 961 cylinders Units = cylinders of 256 * 512 = 131072 bytes Device Boot Start End Blocks Id System /dev/sde1 1 961 122959+ 6 FAT16
Fixed mountpoint
It’s not very nifty to guess which device the card it mounted on. So you can use udev to assign it a fixed device name.
Try a:
udevinfo -a -p /sys/block/sde
At least one device will probably spit out something like this:
device '/sys/block/sde' has major:minor 8:64 looking at class device '/sys/block/sde': SUBSYSTEM="block" SYSFS{dev}="8:64" SYSFS{range}="16" SYSFS{removable}="1" SYSFS{size}="246017" SYSFS{stat}=" 12 348 360 286 0 0 0 0 0 286 286" follow the class device's "device" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0/host5/5:0:0:0': BUS="scsi" ID="5:0:0:0" DRIVER="sd" SYSFS{detach_state}="0" SYSFS{device_blocked}="0" SYSFS{max_sectors}="240" SYSFS{model}="DMC-FZ20 " SYSFS{queue_depth}="1" SYSFS{rev}="0100" SYSFS{scsi_level}="3" SYSFS{state}="running" SYSFS{timeout}="30" SYSFS{type}="0" SYSFS{vendor}="MATSHITA" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0/host5': BUS="" ID="host5" DRIVER="unknown" SYSFS{detach_state}="0" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0': BUS="usb" ID="2-1:1.0" DRIVER="usb-storage" SYSFS{bAlternateSetting}=" 0" SYSFS{bInterfaceClass}="08" SYSFS{bInterfaceNumber}="00" SYSFS{bInterfaceProtocol}="50" SYSFS{bInterfaceSubClass}="06" SYSFS{bNumEndpoints}="02" SYSFS{detach_state}="0" SYSFS{iInterface}="00" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1': BUS="usb" ID="2-1" DRIVER="usb" SYSFS{bConfigurationValue}="1" SYSFS{bDeviceClass}="00" SYSFS{bDeviceProtocol}="00" SYSFS{bDeviceSubClass}="00" SYSFS{bMaxPower}=" 2mA" SYSFS{bNumConfigurations}="1" SYSFS{bNumInterfaces}=" 1" SYSFS{bcdDevice}="0010" SYSFS{bmAttributes}="c0" SYSFS{detach_state}="0" SYSFS{devnum}="5" SYSFS{idProduct}="2372" SYSFS{idVendor}="04da" SYSFS{manufacturer}="Panasonic" SYSFS{maxchild}="0" SYSFS{product}="DMC-FZ20" SYSFS{speed}="12" SYSFS{version}=" 1.10" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.1/usb2': BUS="usb" ID="usb2" DRIVER="usb" SYSFS{bConfigurationValue}="1" SYSFS{bDeviceClass}="09" SYSFS{bDeviceProtocol}="00" SYSFS{bDeviceSubClass}="00" SYSFS{bMaxPower}=" 0mA" SYSFS{bNumConfigurations}="1" SYSFS{bNumInterfaces}=" 1" SYSFS{bcdDevice}="0206" SYSFS{bmAttributes}="c0" SYSFS{detach_state}="0" SYSFS{devnum}="1" SYSFS{idProduct}="0000" SYSFS{idVendor}="0000" SYSFS{manufacturer}="Linux 2.6.9 uhci_hcd" SYSFS{maxchild}="2" SYSFS{product}="Intel Corp. 82801EB/ER (ICH5/ICH5R) USB UHCI #2" SYSFS{serial}="0000:00:1d.1" SYSFS{speed}="12" SYSFS{version}=" 1.10" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.1': BUS="pci" ID="0000:00:1d.1" DRIVER="uhci_hcd" SYSFS{class}="0x0c0300" SYSFS{detach_state}="0" SYSFS{device}="0x24d4" SYSFS{irq}="19" SYSFS{subsystem_device}="0x80a6" SYSFS{subsystem_vendor}="0x1043" SYSFS{vendor}="0x8086" looking at the device chain at '/sys/devices/pci0000:00': BUS="" ID="pci0000:00" DRIVER="unknown" SYSFS{detach_state}="0"
Look for entries like BUS="scsi" here. The line SYSFS{model}="DMC-FZ20 " seems to point to our USB device in question. So you need to go to /etc/udev/rules.d and create a file (which has a ".rules" suffix) there which reads:
BUS=="scsi", SYSFS{model}=="DMC-FZ20*", KERNEL=="sd?1", NAME="%k", SYMLINK="lumix"
Since the files in the rules.d directory are scanned in order of the file names you may want to call the file something like 010_my.rules
This will make udev look for new devices on the SCSI bus (USB flash devices are handled like SCSI devices), check if the model name starts with "DMC_FZ20" (there are often trailing spaces – thus the ‘*’) and has it create a symlink to /dev/lumix so we don’t have to guess which /dev/sd? device it has become. Don’t forget to restart udev.
Mounting
Create a mount point for your device (mkdir /mnt/lumix) and be sure to create an entry in your /etc/fstab so it’s easy to mount:
/dev/lumix /mnt/lumix vfat user,noauto 0 0
Try a mount /mnt/lumix and you should find your data on /mnt/lumix afterwards.
Now if you use KDE it’s easy to create an icon for a partition called /dev/lumix and you can easily mount and unmount the device. Always unmount the card first or the cache will not be written to the flash card which will likely lead to data corruption on the card. You have been warned.
See also
Since you are hopefully using Debian you will find a more complete documentation on writing rules files in /usr/share/doc/udev/writing_udev_rules/index.html
“udevinfo” is “udevadm info” today.
Many thanks.
thank you, this will be useful for me