Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Feb 2005 19:26:16 -0500
From:      Mike Jeays <Mike.Jeays@rogers.com>
To:        Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: SCSI device numbers
Message-ID:  <1108513576.708.5.camel@chaucer.jeays.ca>
In-Reply-To: <44fyzx287a.fsf@be-well.ilk.org>
References:  <1108353173.33317.10.camel@chaucer.jeays.ca> <44fyzx287a.fsf@be-well.ilk.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2005-02-15 at 09:45, Lowell Gilbert wrote:
> Mike Jeays <Mike.Jeays@rogers.com> writes:
> 
> > I have at present two emulated SCSI devices on my system; a USB flash
> > drive, and a DVD-writer.
> > 
> > They get assigned:
> >  
> >  0,0,0     0) 'SanDisk ' 'Cruzer Micro    ' '2033' Removable Disk
> >  2,0,0   200) 'HL-DT-ST' 'DVDRAM GSA-4160B' 'A300' Removable CD-ROM
> > 
> > if the USB device is present at boot time (I think).
> > 
> > So my script for burning CDs, which says:
> >   mkisofs -J -L -R -o x1.iso "$*"
> >   cdrecord -v dev=2,0,0 x1.iso
> >   rm -f x1.iso
> > is very fragile.
> > 
> > How should I do it?  Write a script to read the output of cdrecord
> > -scanbus and grab the device number?  There has to be a "right" way, and
> > instinct says this isn't it.
> 
> It's not a bad way.  
> 
> I'm not sure I understand why the device numbering is so fragile,
> though; wouldn't the ATAPI buses available at boot time be the same
> whether they have devices or not?

I don't understand either, but it happens.  I rebooted with the flash
drive not plugged in, and the DVD burner is now dev=1,0,0.  Then I
inserted the flash drive, and it was assigned dev=2,0,0.  A second flash
drive got 3,0,0 - which seems reasonable.

So I wrote a tiny Perl script to find the unit number, and call it
before running cdrecord.  It works OK, but it still seems like a kludge
to me.

Thanks for the help.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1108513576.708.5.camel>