> -----Original Message-----
> From: Nick Guenther [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 11 October 2007 8:01 PM
> To: Edwards, David (JTS)
> Cc: misc@openbsd.org
> Subject: Re: Which remvable drive is connected to which USB port
>
> On 10/11/07, Edwards, David  (JTS)
> <[EMAIL PROTECTED]> wrote:
> > Hi again.
> >
> > Just a wrap up to this thread.
> > -----------------
[snip]

>> I'm not happy with the fact that the script uses dmesg output.
>> dmesg uses a ring buffer and that can fill very quickly
>> (say if you unplug a usb disk while something is writing
>> to it) which will break the above script totally.  However,
>> currently I don't have the time (or probably the expertise)
>> to go through the source to work out a better way to do
>> it.

> everything in dmesg is also dumped to /var/log/messages.
> disk naming *is* consistent in OpenBSD. devices are all named in a
> deterministic manner, so that they won't change on you without you
> realizing it / adding an extra layer of naming indirection.
>
> What are you actually trying to do here? boot from a USB disk?

Hi, thanks for responding.

I'm using USB disks for backups.

The problem I have is that there are multiple backup sets that
I need to keep for different purposes so I need to know which
physical USB port a disk device is attached to.

I've got three USB cables labelled with the names of the backup
sets (set 1, set 2...) and when I swap a disk on one of the
cables, I need to know the disk device to mount so that I can
dump the right set onto it..

It seems that the disk devices are named (sd1, sd2 etc) based
on which one is plugged in first (unrelated to the physical
port).  My testing shows that the disk device names are retained
as long as the box is not rebooted, but if it reboots, then
I can no longer be sure that the right disk is plugged into
the right port and my backup sets would get mixed up.

So, basically I need a tool where I can start with a physical port
description (seems /dev/usb# "addr #" works) and end with a disk
device (sd#).

The script I put together works fine, but it relies on dmesg (or
as you suggested /var/log/messages) which grates on my sense of
neatness (or maybe I'm being too precious :-)

I'll take the time to have a look at the sources one day.  I'm
sure it would be possible to write a tool that would be able to
work this out in a better way.  Would you have any pointers as
to where to start looking?

ciao
dave
---
Dave Edwards

Reply via email to