On Tuesday 11 July 2006 22:16, Hai Yi wrote:
> Hello there:
>
> I have a creative flash with a usb port, after I plugged it in the
> port, I see this:
>
> $ lsusb
>
> Bus 003 Device 004: ID 041e:4139 Creative Technology, Ltd
> Bus 003 Device 001: ID :
> Bus 002 Device 001: ID :
> Bus 001 Device 004: ID 06cb:0003 Synaptics, Inc.
> Bus 001 Device 003: ID 045e:0053 Microsoft Corp.
> Bus 001 Device 001: ID :
>
> Then I issued a command (might be wrong)
> mount -t usbfs /proc/bus/usb/003/004 /mnt/
>
> Then I am struck in the middle of nowhere, don't know how to proceed
> to access the content in my flash.
# umount /mnt
While what you tried seems like a very logical command, it's really the
completely wrong tack, for several reasons:
a) lsusb doesn't give you the information you need to mount the drive
b) /proc/bus/usb/003/004 isn't a device node
c) usbfs isn't a way of accessing data on a USB device.
A device node is a special kind of file living somewhere in /dev that
when read from or written to, passes through the device driver and
actually talks to the device.
The information you're looking for when you mount a device is actually
printed by the kernel when you attach the device. If you're using X
window, then you won't see it, but no worries. You can always see the
log of kernel messages by typing dmesg (as a normal user). Here's the
relevant portion of my dmesg when I attach my thumb drive:
usb 1-1: new full speed USB device using uhci_hcd and address 2
usb 1-1: configuration #1 chosen from 1 choice
SCSI subsystem initialized
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
Vendor: SanDisk Model: U3 Cruzer Micro Rev: 2.15
Type: Direct-Access ANSI SCSI revision: 02
Vendor: SanDisk Model: U3 Cruzer Micro Rev: 2.15
Type: CD-ROM ANSI SCSI revision: 02
usb-storage: device scan complete
SCSI device sda: 990865 512-byte hdwr sectors (507 MB)
sda: Write Protect is off
sda: Mode Sense: 03 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 990865 512-byte hdwr sectors (507 MB)
sda: Write Protect is off
sda: Mode Sense: 03 00 00 00
sda: assuming drive cache: write through
sda: sda1
sd 0:0:0:0: Attached scsi removable disk sda
The relevant line is the following:
sda: sda1
this line is the list of device files corresponding to the partitions on
the thumb drive. (Yes, you can have multiple partitions)
* sda is the device file corresponding to the whole drive.
* the drive has one partition, named sda1.
You want to mount sda1. The device files are found in /dev, so you want
to issue some variant of the command "mount /dev/sda1 /mnt"
usbfs is completely the wrong filesystem type. It's simply an
informational filesystem[1], kinda like proc (mounted on /proc) or
sysfs (mounted on /sys) that doesn't contain any real data on any disk.
It also doesn't take a device name. Actually, it takes a path to a
device and completely ignores it, not even bothering to check that it
exists, so by convention something like "none" or "usbfs" is used.
However, when you told it that /proc/bus/usb/003/004 was the device
file, that was allowed too. It completely ignored it and mounted the
informational filesystem on /mnt (and didn't spew out any error
messages because you hadn't actually done anything wrong from the
system's point of view).
The filesystem on your flash drive (unless you reformatted it) is of
type vfat. So the correct, fully specified command would be "mount -t
vfat /dev/sda1 /mnt". It's not actually necessary to specify the
filesystem type though -- the kernel can autodetect the file system
type, so the command I gave before ("mount /dev/sda1 /mnt") would also
work just fine.
But there's a better way to mount this...
You have to run the mount command as root (which I'm sure you did) to
mount a usb device. This is becuase when USB devices came along, they
completely broke the kernel's old way for users to mount their own
disks. Back in the days of floppies, a device always had the same
device nodes. When you inserted a floppy disk, you *knew* that it's
device node was /dev/fd0. USB changed all that. Since you could now
plugin as many USB devices as you wanted, in as many orders as you
wanted, and they all showed up as SCSI disks (/dev/sd*), they began to
move around. The old method of specifying a device that users could
mount in /etc/fstab broke, because now there were many devices.
So the distributions created pmount. A user in the plugdev group can
mount a USB device to a mountpoint in /media in a very simple
way: "pmount /dev/sda1" (replacing, of course the device name with the
one you discovered above using dmesg). The mountpoint on which this is
mounted is