Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

USB storage udev problems

Need help with peripherals or devices?
Message
Author
User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

USB storage udev problems

#1 Post by utrrrongeeb »

Hi,
I'm trying to set up USB storage devices using udev. However, some devices are causing trouble. There is a card reader with two card slots, and my brother and I have the same type of USB drive. The card reader's two slots both have the same parameters (vendor, model, etc.), and the USB drives also have the same parameters, being the same product. What I'm wondering is, how do I define (in /etc/udev/udev.rules and /etc/fstab) these identical devices?

A separate question involves those USB drives again. Sometimes, I plug one of them in, and udev mounts them, as expected. Then I might remove them, plug them in again, and see

Code: Select all

mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
The next few minutes, though, it might mount correctly again.
Can anyone explain this behaviour?

All helpful responses are greatly appreciated!
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#2 Post by utrrrongeeb »

It seems these large forums have a problem of posts being buried.

I can elaborate if requested.
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#3 Post by Grifter »

umount the devices before removing them to be on the safe side, also use sync as one of hte mount options
Eagles may soar, but weasels don't get sucked into jet engines...

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#4 Post by utrrrongeeb »

Thanks for the answer; I'm assuming that was an answer for the second question? If so, the first is still open. I'll try your suggestion the next time I'm in Debian with some time.
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#5 Post by utrrrongeeb »

Can anyone answer the first question, or is this post buried again? I think most devices will be okay, but those mentioned above give me trouble.
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#6 Post by utrrrongeeb »

Seems like it's buried again.

There still is an unanswered question: I have two USB devices of the exact same model. How can I tell udev and fstab how to be able to handle them both at the same time?
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#7 Post by utrrrongeeb »

Turns out that the above question AND the 'answered' question still need answers. I tested some USB drives yesterday, and two of them wouldn't mount. Any responses are appreciated!
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#8 Post by utrrrongeeb »

I'm still having trouble with USB drives. Often, they don't mount. The most common error is 'VFAT filesystem not found', or something of that meaning.
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

ajdlinux
Posts: 2452
Joined: 2006-04-23 09:37
Location: Port Macquarie, NSW, Australia

#9 Post by ajdlinux »

Perhaps noone has anything to say...

These USB devices would get separate names /dev/sda and /dev/sdb wouldn't they?

If you install hal-device-manager and run that can you see both of them?
Jabber: xmpp:ajdlinux@jabber.org.au
Spammers, email this: ajdspambucket@exemail.com.au

User avatar
bluesdog
Posts: 2077
Joined: 2006-02-01 09:02
Location: Similkameen, British Columbia, Canada
Been thanked: 1 time

#10 Post by bluesdog »

What is output of

Code: Select all

dpkg -l usb*
Tips & Tricks

Something more to read while waiting

If you obviously have not read THIS, don't expect too much...




*winter bluesdog....*

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#11 Post by utrrrongeeb »

The output of dpkg -l usb* is

Code: Select all

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
un  usbmgr         <none>         (no description available)
ii  usbutils       0.70-8         USB console utilities

However, I'm trying to use fstab and udev.rules to control the USB drives. I'll post my fstab and udev.rules when I get around to it (probably tomorrow). Thanks for responding!
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#12 Post by utrrrongeeb »

And here is my fstab:

Code: Select all

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hdb1       /               ext3    defaults,errors=remount-ro 0       1
/dev/hdb2       /mnt/hdb2       vfat    rw,async,auto,exec,gid=humans,umask=007        0       2
/dev/hda2       /mnt/hda2       ntfs    ro,nls=utf8,gid=humans,auto,noexec,dmask=0227,fmask=0337  0       0
/dev/hdb3       /mnt/hdb3       ntfs    ro,users,nls=utf8,gid=humans,noauto,noexec,dmask=0227,fmask=0337  0       0
/dev/hda1       /mnt/hda1       vfat    ro,users,gid=humans,noauto,noexec,dmask=0227,fmask=0337  0    0
/dev/hda3       /mnt/hda3       vfat    ro,users,gid=humans,noauto,noexec,dmask=0227,fmask=0337  0    0
/dev/hdc        /media/cdrom0   iso9660 ro,user,noauto  0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
/dev/apusb	/media/apusb	auto	rw,sync,users	0	0
/dev/ddusb	/media/ddusb	auto	rw,sync,users	0	0

And here is the modified section of my udev.rules:

Code: Select all

#Flash devices
BUS="scsi", SYSFS{vendor}="Generic*", SYSFS{model}="STORAGE DEVICE*", NAME="cardreader%n"
BUS="scsi", SYSFS{vendor}="Memorex*", SYSFS{model}="TD 2C*", NAME="apusb%n"
BUS="scsi", SYSFS{vendor}="SONY*", SYSFS{model}="Storage Media*", NAME="ddusb%n"

Any more help on this is appreciated!
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
bluesdog
Posts: 2077
Joined: 2006-02-01 09:02
Location: Similkameen, British Columbia, Canada
Been thanked: 1 time

#13 Post by bluesdog »

I wonder if usbmount might help? If you're running a 2.6 .xxx kernel, apt-get install it and see..
Tips & Tricks

Something more to read while waiting

If you obviously have not read THIS, don't expect too much...




*winter bluesdog....*

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#14 Post by utrrrongeeb »

Thanks for the suggestion, I'll try it. There's two problems here -- the first is, how do I set up udev.rules and fstab for two identical USB devices? The second is that some devices refuse to mount with the No Filesystem error. The drives are also used under Windows, if that makes any difference. I tried a drive yesterday, mount /dev/apusb worked for it.
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
dawgie
Posts: 430
Joined: 2004-06-16 21:30
Location: New Hampshire USA

#15 Post by dawgie »

lecaro wrote:Thanks for the suggestion, I'll try it. There's two problems here -- the first is, how do I set up udev.rules and fstab for two identical USB devices?
Don't they have different serial numbers?

you can use the serial numbers in your udev.rules:

SYSFS{serial}="12345"

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#16 Post by utrrrongeeb »

Thanks a lot!! :D
I'll try that, it sounds like it will work. Where do I find the serial numbers? The scanners I use for USB info are lsusb, systool -vb scsi, fdisk -l, and /proc/partitions.
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
dawgie
Posts: 430
Joined: 2004-06-16 21:30
Location: New Hampshire USA

#17 Post by dawgie »

Using systool to find the model on my machine

# systool -vb scsi | grep model


model = "Maxtor 6L200M0 "
model = "USB SD Reader "
model = "USB CF Reader "
model = "USB SM Reader "
model = "USB MS Reader "

I have a sata HD and a card reader with four slots





But the "5-in-one" card reader only has one serial number:

Using udevinfo to find the serial number. Udevinfo needs the device path as an arguement.

# udevinfo -a -p /sys/block/sdb | grep -A 1 serial
SYSFS{serial}=="2004888"
SYSFS{product}=="USB Reader"

# udevinfo -a -p /sys/block/sdc | grep -A 1 serial
SYSFS{serial}=="2004888"
SYSFS{product}=="USB Reader"




Using udevinfo to find the model:

# udevinfo -a -p /sys/block/sda | grep -A 1 model
SYSFS{model}=="Maxtor 6L200M0 "
SYSFS{vendor}=="ATA "
# udevinfo -a -p /sys/block/sdb | grep -A 1 model
SYSFS{model}=="USB SD Reader "
SYSFS{vendor}=="Generic "
# udevinfo -a -p /sys/block/sdc | grep -A 1 model
SYSFS{model}=="USB CF Reader "
SYSFS{vendor}=="Generic "
# udevinfo -a -p /sys/block/sdd | grep -A 1 model
SYSFS{model}=="USB SM Reader "
SYSFS{vendor}=="Generic "
# udevinfo -a -p /sys/block/sde | grep -A 1 model
SYSFS{model}=="USB MS Reader "
SYSFS{vendor}=="Generic "


You can also nest udevinfo to find the sysfs path:
# udevinfo -a -p $(udevinfo -q path -n /dev/sdb)

will give the same results as

# udevinfo -a -p /sys/block/sdb

There are also some gui utilities where you can collect this info such as usbview or even the Kde control center.

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#18 Post by utrrrongeeb »

Thanks!! I hadn't heard of udevinfo. The other USB info source I use is /proc/bus/usb/devices. I found out the serial somewhere; that will help for the separate USB drives. However, I also have a two-slot card reader, and each slot has the same information. Can I do it any better than two separate fstab lines, as udev.rules has NAME="cardread%n"?
The next problem is that a USB drive, after several successful tests, refused to mount saying that no filesystem was found. A glance at fdisk -l said that the mountable portion of the drive was /dev/sdc, not /dev/sdc1. What has caused this lack of a partition, and why can't udev notice it?
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

User avatar
dawgie
Posts: 430
Joined: 2004-06-16 21:30
Location: New Hampshire USA

#19 Post by dawgie »

lecaro wrote: I also have a two-slot card reader, and each slot has the same information. Can I do it any better than two separate fstab lines, as udev.rules has NAME="cardread%n"?
Each of the two slots should be located in a different device chain in the sysfs. If you use udevinfo to collect the information, the "-a" switch will give all the possible info that could be used to identify the particular device.

From the udevinfo man page:
OPTIONS

-a Print all sysfs properties of the specified device that can be
used in udev rules to match the specified device. It prints all
devices along the chain, up to the root of sysfs that can be
used in udev rules.


If you look at each scsi location, one at a time for all the info for a particular device:

# udevinfo -a -p /sys/block/sda
# udevinfo -a -p /sys/block/sdb
# udevinfo -a -p /sys/block/sdc

etc

You may find something to differentiate the two devices

The next problem is that a USB drive, after several successful tests, refused to mount saying that no filesystem was found. A glance at fdisk -l said that the mountable portion of the drive was /dev/sdc, not /dev/sdc1. What has caused this lack of a partition, and why can't udev notice it?
I have seen this same problem with some USB sticks. Also I have also seen some USB sticks with fat12 filesystem, whatever that is.
I think that we see this strange things with USB devices because much of the USB devices manufactured are not compliant with USB standards.


/dev/sdc
Would normally be the name of a device
and
/dev/sdc1
Would normally be the 1st partition on the device.
If it were mine, I would repartition and reformat it.

User avatar
utrrrongeeb
Posts: 254
Joined: 2006-05-14 09:48
Location: Eastern Canada

#20 Post by utrrrongeeb »

Thanks for responding; I'll try repartitioning and refilesysteming (a word?) my USB drive, and see if the cardreader has any differences.
utrrrongeeb formerly lecaro
Art #429775 on 'Etch' 4.0r0

Post Reply