LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   USB flash drive mount problem (http://www.linuxquestions.org/questions/linux-general-1/usb-flash-drive-mount-problem-371368/)

servnov 10-09-2005 09:43 PM

USB flash drive mount problem
 
I can usually just plug in a USB device into a slot and type mount /dev/sda1 and everything is fine. But *sometimes* when I type mount /dev/sda1 I get:

Code:

mount: /dev/sda1 is not a valid block device
I ticks me off. How do I fix it?--I reboot the comp and then type mount /dev/sda1 and it just works. Why do I have to reboot the comp to do this?

ioerror 10-10-2005 01:52 PM

What's the output of dmesg?

Are you sure it's always at /dev/sda1? It you have other devices (scanners etc show up as SCSI devices), it may be something different.
It can also take a couple of seconds for the device to be "ready". Occasionally, I get a similar error, waiting a few seconds until the device is ready to talk usually suffices.

If you're using 2.6, you can use udev to assign a permanent name to the device. I haven't got around to setting up udev yet, so I can't offer any details.

In any case, you can always label the filesystem and use that instead of /dev/whatever. With ext2/3, you can use e2label:

Code:

e2label /dev/sda1 <label name>
The label name can be whatever you want. Then modify /etc/fstab, replacing /dev/sda1 with LABEL=<label name>.

Instead of using the device name or label with mount, it's better/easier to use the mount point, e.g.

Code:

mount /mnt/usb
or whatever.

servnov 10-10-2005 02:11 PM

Ok, I will try using the mount point instead of the device name. Its just so odd how sometimes it will work and sometimes it wont. Usually if I mount and then umount the device and then try to mount it again without rebooting it refuses. I got it in /etc/fstab already and I am using a 2.4 kern.

ioerror 10-10-2005 02:55 PM

Quote:

Usually if I mount and then umount the device and then try to mount it again without rebooting it refuses.
That certainly sounds strange. What happens if you unplug it and plug it back in? What does dmesg report?

You'd also get a "not a valid block device" error if one of the necessary modules was being unloaded for some reason (though a simple umount should not cause modules to be unloaded). You need usb-storage, scsi support of course, and sd_mod if it's not built into the kernel. A while back, I was using a kernel with scsi support configured as modules and sometimes sd_mod wasn't being modprobed but I can't remeber why. I currently have scsi support built into the kernel, with usb-storage as a module. Sometimes, a 'depmod -a' can fix that, though that should be run automatically by the pkg manager when you (re)install a kernel.

Another thing that can cause problems is the LUN (logical unit number) scan. I had an external SCSI drive years ago (like a zip, but a different make of course) that screwed up if I had the 'Probe all LUNs on each SCSI device' option set, though modern devices shouldn't have that problem.

On the other hand, if you have one of these multi-card readers (cf, sd, etc), you generally need that option turned ON for it to work. I have a multi-card reader which I seem to recall behaved similarly to what you describe until I turned on the LUN probe option, but a USB drive *should* just be a single device so the LUN option shouldn't matter. Unless the've set it up as mutiple logical devices for some reason.

DeusExLinux 10-10-2005 08:08 PM

I have that problem sometimes ... What I do to fix it is the follwing:
Open up a terminal
log on as root
run : fidsk -l /dev/sda*

What this does is list everything connected to a /dev/sdaX, the computer will then regiester that the drive is there and you can mount it.. saves you a reboot.


All times are GMT -5. The time now is 09:23 PM.