Hi folks. I'm using a number of USB drives connected to the same server for backup purposes. And there will be different backup sets from the server that need to be kept separated. So I really need to be able to plug a disk into a specific USB cable and know that the correct backup set will be delivered to that particular disk.
My problem is that I need to figure out the device name (sd#) for a drive that's plugged into a particular usb cable. I'm using a device/address description as the basis of this. For instance, "/dev/usb4 addr 4" corresponds to a particular physical USB port (I believe). So far I'm using a script which does the following: ---------- # usbdevs -f /dev/usb4 -d | grep -A 1 "addr 4" | tail -1 umass1 # dmesg | grep scsibus | grep umass1 | tail -1 scsibus3 at umass1: 2 targets # dmesg | grep scsibus3 | tail -1 sd2 at scsibus3 targ 1 lun 0: <WDC WD25, 00BEVS-11UST0, > SCSI2 0/direct fixed ## Check if it's been detached again.. # dmesg | grep sd2 | tail -1 sd2: 238475MB, 238475 cyl, 64 head, 32 sec, 512 bytes/sec, 488397168 sec total --------- At this point, I can check the file system on sd2 and perform the backup. This is overly complicated, prone to failure (relies on a circular buffer) and I'd really like to find a better way to do it. Can anyone point me to some information that might let me write my own tool (or modify an existing tool) that will trace a physical USB port to the name of the device plugged into the port? Apologies to people who followed an earlier thread about this issue ("http://marc.info/?t=118713340200003&r=1&w=2") I thought I'd give it another go for people that missed it the first time round. If I don't get any further this time, I'll give up and post the script I've written to close both threads. ciao dave --- Dave Edwards