# loading usb mass storage devices

## jbwillia

First off, I have searched all the previous usb postings as well as google without any success. That said, I can successfully load my digital camera and zip 250 as mass storage devices without a problem.

The problem is this: every time I plug one of these devices in, a new host (in /dev/scsi)  is being created but not removed when the device is disconnected, so after about 10 connect/disconnect sequences I have quite a few unneccessary hosts in /dev/scsi. I am using the 2.6.6 kernel if that's any help. On my old debian box the zip drive would always be assigned to /dev/scsi/host1 and the camera to /dev/scsi/host2, and these hosts were removed when I disconnected.

----------

## Frodg

Are you using devfs or udev ?

with udev you can assign a symbolic link that will always represent your storage device.

see the posts for udev for more information.

----------

## jbwillia

Right now I have both udev and devfs; however, I just recompiled my 2.6.6 kernel without devfs support. I have also previously emerged udev, hotplug, and baselayout. This problem was present both before and after installing udev. Before I installed udev, I was running pure devfs. I had the exact same problem then as I do now ... every time I plugged in a usb mass storage device a new /dev/scsi/host# would be created and when I unplugged it (it was never mounted by the way!!) the host would still be there. I'm hoping this is just a race condition caused by devfs, so when I go pure udev, it should be gone (or so I hope  :Smile: .

On a side note, my system is a dual proc sparc64; i don't think this should be an issue, but it is a possibility (in which case I'll talk to the sparc guys).

----------

## teutzz

just going to pure udev won't resolve your problem, you'll also have to write a udev rule to make everything working properly

----------

## jbwillia

ah, yes ... I will be writing a udev rule to assign it to a specific device node, but my problem is one layer below that ... by the way, I am pure udev now, and it's working much better than devfs thus far. The only thing I wonder about now is that it is still assigning scsi host numbers incrementally even when they they've been disconnected ... it's almost like it doesn't know the last device had been disconnected even though the host is no longer listed in /sys ... here's a few excerpts fromn my syslog:

```
Jun  9 16:25:44 odin scsi.agent[31675]: disk at /devices/pci0000:80/0000:80:01.0/usb2/2-1/2-1:1.0/host4/4:0:0:0

```

I then disconnected the device without ever mounting and /sys/devices/pci0000:80/0000:80:01.0/usb2/2-1/2-1:1.0/ was empty as it should be, but when I plugged the mass storage device back in a second time a few minutes later I get this:

```
Jun  9 16:47:28 odin scsi.agent[31877]: disk at /devices/pci0000:80/0000:80:01.0/usb2/2-1/2-1:1.0/host5/5:0:0:0

```

So, the question is: why did it it not reassigne to host4 the second time? It has to be something in the scsi drivers right?

----------

## Frodg

Interesting...

I don't know the answer to that other than you may be on the threshold of dicovering the finite number of hosts possible in the linux world...   :Smile: 

----------

