Which removable drive is connected to which USB port

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <misc@...>
Date: Sunday, September 2, 2007 - 9:26 pm

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: 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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
That whole "Linux stealing our code" thing, Theo de Raadt, (Fri Aug 31, 9:40 pm)
Re: That whole "Linux stealing our code" thing, Reyk Floeter, (Mon Sep 3, 7:23 am)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sat Sep 1, 1:19 pm)
Re: That whole "Linux stealing our code" thing, Hannah Schroeter, (Sun Sep 2, 8:05 am)
Re: That whole "Linux stealing our code" thing, Ihar Hrachyshka, (Sun Sep 2, 8:25 am)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sun Sep 2, 11:42 am)
Re: That whole "Linux stealing our code" thing, Marco Peereboom, (Sun Sep 2, 12:00 pm)
Re: That whole "Linux stealing our code" thing, Hannah Schroeter, (Sun Sep 2, 10:58 am)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sun Sep 2, 8:15 am)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 1:39 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sat Sep 1, 5:59 pm)
Re: That whole "Linux stealing our code" thing, Hannah Schroeter, (Sun Sep 2, 8:07 am)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sun Sep 2, 11:38 am)
Re: That whole "Linux stealing our code" thing, Dave Anderson, (Mon Sep 3, 12:35 am)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Mon Sep 3, 3:42 am)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Tue Sep 4, 12:12 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Tue Sep 4, 5:18 pm)
Re: That whole "Linux stealing our code" thing, J.C. Roberts, (Wed Sep 5, 2:56 pm)
Re: That whole "Linux stealing our code" thing, Marco Peereboom, (Tue Sep 4, 11:15 pm)
Re: That whole "Linux stealing our code" thing, Jacob Yocom-Piatt, (Tue Sep 4, 12:37 pm)
Re: That whole "Linux stealing our code" thing, Simon 'corecode' Schubert..., (Sun Sep 2, 12:15 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sun Sep 2, 12:22 pm)
Re: That whole "Linux stealing our code" thing, Marco Peereboom, (Sun Sep 2, 11:57 am)
Re: That whole "Linux stealing our code" thing, Greg Thomas, (Tue Sep 4, 12:21 am)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 6:08 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sat Sep 1, 6:29 pm)
Re: That whole "Linux stealing our code" thing, Marco Peereboom, (Sat Sep 1, 6:56 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sat Sep 1, 7:34 pm)
Re: That whole "Linux stealing our code" thing, Siegbert Marschall, (Sun Sep 2, 5:15 am)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sun Sep 2, 7:49 am)
Re: That whole "Linux stealing our code" thing, Siegbert Marschall, (Sun Sep 2, 4:56 pm)
Re: That whole "Linux stealing our code" thing, Constantine A. Murenin, (Sat Sep 1, 6:51 pm)
Re: That whole "Linux stealing our code" thing, Martin Schröder, (Sat Sep 1, 7:21 pm)
Re: That whole "Linux stealing our code" thing, Constantine A. Murenin, (Sat Sep 1, 7:42 pm)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 6:40 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sat Sep 1, 6:49 pm)
Re: That whole "Linux stealing our code" thing, Daniel A. Ramaley, (Tue Sep 4, 12:37 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Tue Sep 4, 1:38 pm)
Re: That whole "Linux stealing our code" thing, Timo Schoeler, (Tue Sep 4, 3:41 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Tue Sep 4, 3:52 pm)
Re: That whole "Linux stealing our code" thing, Timo Schoeler, (Tue Sep 4, 4:08 pm)
Re: That whole "Linux stealing our code" thing, Darrin Chandler, (Tue Sep 4, 4:27 pm)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 6:55 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sat Sep 1, 7:39 pm)
Re: That whole "Linux stealing our code" thing, Siegbert Marschall, (Sun Sep 2, 5:17 am)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sun Sep 2, 7:44 am)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 7:46 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sun Sep 2, 4:47 am)
Re: That whole "Linux stealing our code" thing, Jeroen Massar, (Sun Sep 2, 5:32 am)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sun Sep 2, 7:42 am)
Re: That whole "Linux stealing our code" thing, Jason Dixon, (Sun Sep 2, 9:49 am)
Re: That whole "Linux stealing our code" thing, Timo Schoeler, (Sun Sep 2, 9:44 am)
Re: That whole "Linux stealing our code" thing, Tonnerre LOMBARD, (Sun Sep 2, 8:36 am)
Re: That whole "Linux stealing our code" thing, Jeroen Massar, (Sun Sep 2, 8:12 am)
Which removable drive is connected to which USB port, Edwards, David (JTS), (Sun Sep 2, 9:26 pm)
Re: That whole "Linux stealing our code" thing, Rui Miguel Silva Seabra, (Sun Sep 2, 11:36 am)
Re: That whole "Linux stealing our code" thing, Gregg Reynolds, (Sat Sep 1, 3:02 pm)
Re: That whole "Linux stealing our code" thing, David H. Lynch Jr., (Sat Sep 1, 8:52 am)
Re: That whole "Linux stealing our code" thing, Todd T. Fries, (Sat Sep 1, 4:28 pm)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 9:46 am)
Re: That whole "Linux stealing our code" thing, David H. Lynch Jr., (Sat Sep 1, 3:12 pm)
Re: That whole "Linux stealing our code" thing, Marc Espie, (Sat Sep 1, 9:40 am)
Re: That whole "Linux stealing our code" thing, Marco Peereboom, (Sat Sep 1, 9:40 am)
Re: That whole "Linux stealing our code" thing, Jona Joachim, (Tue Sep 4, 7:57 pm)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Tue Sep 4, 8:16 pm)
Re: That whole "Linux stealing our code" thing, Jona Joachim, (Tue Sep 4, 9:11 pm)
Re: That whole "Linux stealing our code" thing, Brett Lymn, (Tue Sep 4, 9:07 pm)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Tue Sep 4, 10:55 pm)
Re: That whole "Linux stealing our code" thing, Siju George, (Sat Sep 1, 3:29 pm)
Re: That whole "Linux stealing our code" thing, Emilio Perea, (Sat Sep 1, 4:17 pm)
Re: That whole "Linux stealing our code" thing, Constantine A. Murenin, (Sat Sep 1, 4:14 pm)
Re: That whole "Linux stealing our code" thing, Alexander Hall, (Sat Sep 1, 4:14 pm)
Re: That whole "Linux stealing our code" thing, David Newman, (Sat Sep 1, 4:13 pm)
Re: That whole "Linux stealing our code" thing, Darren Spruell, (Sat Sep 1, 4:11 pm)
Re: That whole "Linux stealing our code" thing, Antti Harri, (Sat Sep 1, 4:08 pm)
Re: That whole "Linux stealing our code" thing, Constantine A. Murenin, (Sat Sep 1, 9:31 am)
Re: That whole "Linux stealing our code" thing, David H. Lynch Jr., (Sat Sep 1, 2:49 pm)
Re: That whole "Linux stealing our code" thing, Marco Peereboom, (Sat Sep 1, 6:42 pm)
Re: That whole "Linux stealing our code" thing, Gregg Reynolds, (Sat Sep 1, 5:47 pm)
Re: That whole "Linux stealing our code" thing, Darren Spruell, (Sat Sep 1, 4:36 pm)
Re: That whole "Linux stealing our code" thing, Reiner Jung, (Sat Sep 1, 5:45 pm)
Re: That whole "Linux stealing our code" thing, Todd T. Fries, (Sat Sep 1, 9:10 pm)
Re: That whole "Linux stealing our code" thing, Siju George, (Sun Sep 2, 4:43 am)
Re: That whole "Linux stealing our code" thing, Hannah Schroeter, (Sun Sep 2, 7:43 am)
Re: That whole "Linux stealing our code" thing, Artur Grabowski, (Mon Sep 3, 8:24 am)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 4:25 pm)
Re: That whole "Linux stealing our code" thing, Hannah Schroeter, (Sun Sep 2, 7:35 am)
Re: That whole "Linux stealing our code" thing, Dave Anderson, (Sun Sep 2, 10:54 am)
Re: That whole "Linux stealing our code" thing, Gregg Reynolds, (Sun Sep 2, 1:03 pm)
Re: That whole "Linux stealing our code" thing, mcb, inc., (Sun Sep 2, 6:59 pm)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 9:54 am)
Re: That whole "Linux stealing our code" thing, Jeroen Massar, (Sat Sep 1, 9:10 am)
Re: That whole "Linux stealing our code" thing, Dmitrij D. Czarkoff, (Sat Sep 1, 2:21 am)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 2:42 am)
Re: That whole "Linux stealing our code" thing, Toni Mueller, (Mon Sep 3, 5:01 am)
Re: That whole "Linux stealing our code" thing, Shawn K. Quinn, (Sat Sep 1, 4:29 pm)
Re: That whole "Linux stealing our code" thing, Ihar Hrachyshka, (Sat Sep 1, 4:37 am)
Re: That whole "Linux stealing our code" thing , Theo de Raadt, (Sat Sep 1, 10:14 am)
Re: That whole "Linux stealing our code" thing, David H. Lynch Jr., (Sat Sep 1, 12:54 am)
Re: That whole "Linux stealing our code" thing, Hannah Schroeter, (Sun Sep 2, 7:24 am)