View previous topic :: View next topic |
Author |
Message |
Attis SH n00b
Joined: 23 Feb 2003 Posts: 62 Location: Budapest, Hungary
|
Posted: Sat Jun 28, 2003 10:50 pm Post subject: Problem with multiple USB/SCSI Mass Storage devices |
|
|
I have two USB Mass Storage devices: a flash drive and a digital camera. My problem is that they appear on different devices depending on the order they are attached to the computer, eg. if I attach the flash drive first, it will be /dev/scsi/host1 and the camera /dev/scsi/host2 but if attach the camera first it will be /dev/scsi/host1 and the flash drive /dev/scsi/host2 (I have an IDE CD-RW on /dev/scsi/host0).
Is there a way to have the camera appear on /dev/scsi/host1 and the flash drive on /dev/scsi/host2 all the time? |
|
Back to top |
|
|
manny15 Guru
Joined: 01 Dec 2002 Posts: 473 Location: USA
|
Posted: Mon Aug 11, 2003 11:26 pm Post subject: |
|
|
I'm having the same problem. I have a usb zip and a usb cd-writer. Right now, I can't mount my zip (unless I specify the "new" host ans such) because I happened to plug in my cd-writer first. I wish there was a solution to this. Any ideas? Anyone? |
|
Back to top |
|
|
manny15 Guru
Joined: 01 Dec 2002 Posts: 473 Location: USA
|
Posted: Tue Aug 12, 2003 12:11 am Post subject: |
|
|
I looked around a bit on my system and noticed/remembered about /dev/discs/. This directory (when using devfs) contains symbolic links to appropriate "hard disk" devices. For example. My system has two hard drives. With my usb zip drive plugged in AFTER my cd-writer I get...
Code: |
lr-xr-xr-x 1 root root 30 Dec 31 1969 disc0 -> ../ide/host0/bus0/target0/lun0
lr-xr-xr-x 1 root root 30 Dec 31 1969 disc1 -> ../ide/host0/bus1/target0/lun0
lr-xr-xr-x 1 root root 31 Dec 31 1969 disc2 -> ../scsi/host2/bus0/target0/lun0
|
This first two disks are the ide drives and the third the zip disk. My /etc/fstab used mount /dev/sda4 to /mnt/zip, but I changed it to /dev/discs/disc2/part4 /mnt/zip. /devsda4 is a link generated by devfs when the zip is plugged in. Like you, it sometimes points to the wrong device because it is hard coded like this...
Code: |
LOOKUP ^sda4 CFUNCTION GLOBAL mksymlink scsi/host1/bus0/target0/lun0/part4 sda4
REGISTER ^scsi/host1/bus0/target0/lun0/part4 CFUNCTION GLOBAL mksymlink $devname
sda4
UNREGISTER ^scsi/host1/bus0/target0/lun0/part4 CFUNCTION GLOBAL unlink sda4
|
So I'm trying the disc thing to see what happens. Maybe devfs can be configured better but I have yet to find a good "HOWTO". Hope it's a step in the right direction. |
|
Back to top |
|
|
Attis SH n00b
Joined: 23 Feb 2003 Posts: 62 Location: Budapest, Hungary
|
Posted: Tue Aug 12, 2003 5:26 am Post subject: |
|
|
manny15 wrote: | I looked around a bit on my system and noticed/remembered about /dev/discs/. This directory (when using devfs) contains symbolic links to appropriate "hard disk" devices. For example. My system has two hard drives. With my usb zip drive plugged in AFTER my cd-writer I get...
Code: |
lr-xr-xr-x 1 root root 30 Dec 31 1969 disc0 -> ../ide/host0/bus0/target0/lun0
lr-xr-xr-x 1 root root 30 Dec 31 1969 disc1 -> ../ide/host0/bus1/target0/lun0
lr-xr-xr-x 1 root root 31 Dec 31 1969 disc2 -> ../scsi/host2/bus0/target0/lun0
|
This first two disks are the ide drives and the third the zip disk. My /etc/fstab used mount /dev/sda4 to /mnt/zip, but I changed it to /dev/discs/disc2/part4 /mnt/zip. /devsda4 is a link generated by devfs when the zip is plugged in. |
You are lucky then, because you have two devices of different kinds, a /dev/disc and a /dev/cdrom one. So you are fine using the links in these directories. On the other hand, I have two /dev/disc devices, a digital camera and a flash drive, so this workaround doesn't work for me.
Quote: | Like you, it sometimes points to the wrong device because it is hard coded like this...
Code: |
LOOKUP ^sda4 CFUNCTION GLOBAL mksymlink scsi/host1/bus0/target0/lun0/part4 sda4
REGISTER ^scsi/host1/bus0/target0/lun0/part4 CFUNCTION GLOBAL mksymlink $devname
sda4
UNREGISTER ^scsi/host1/bus0/target0/lun0/part4 CFUNCTION GLOBAL unlink sda4
|
So I'm trying the disc thing to see what happens. Maybe devfs can be configured better but I have yet to find a good "HOWTO". Hope it's a step in the right direction. |
I haven't found any. Please let me know if you come up with anything useful on this matter. |
|
Back to top |
|
|
manny15 Guru
Joined: 01 Dec 2002 Posts: 473 Location: USA
|
Posted: Tue Aug 12, 2003 6:50 pm Post subject: |
|
|
I haven't tried this cause I don't think I need it, but mtools might be your hero. As you might already know, mtools allows you to access fat filesystems (I'm assuming your camera and the flash drive uses fat). The key is defining the possible entries in your mtools config file. You can probably do somthing like this...
Code: |
drive z: file="/dev/sda" partition=1
drive z: file="/dev/sdb" partition=1
drive z: file="/dev/sdc" partition=1
drive y: file="/dev/sda" partition=1
drive y: file="/dev/sdb" partition=1
drive y: file="/dev/sdc" partition=1
|
http://mtools.linux.lu/faq.html
Using mmount you can then mount z (which could be you camera) or y (flash drive). The only tricky part is that it seems like you must have entries for sda, sdb, and sdc in you fstab. So maybe something like this will work better...
Code: |
/dev/discs/disc1/part4 /mnt/camera vfat rw,exec,user,noauto 0 0
/dev/discs/disc1/part4 /mnt/flash vfat rw,exec,user,noauto 0 0
/dev/discs/disc2/part4 /mnt/camera vfat rw,exec,user,noauto 0 0
/dev/discs/disc2/part4 /mnt/flash vfat rw,exec,user,noauto 0 0
|
I'm not sure if multiple entries for the same device are allowed, but if so and if it works like mmount, then if you issue a it will try the first disc, then the second. So now df would show Code: | /dev/discs/disc1/part4 /mnt/flash | . Now do a Hopefully, since the first disc is already mounted it won't try to mount it again, and use disk2 instead. The only thing is you must mount in the order you plug in the devices.
Now, if you were using ext2, you could mount using volume labels instead of device names. (See man page for tune2fs, fstab) Who knows, it might actually work with fat too (see man mkfs.vfat). |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|