From owner-freebsd-questions@FreeBSD.ORG Wed Feb 16 00:26:19 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A5D616A4CE for ; Wed, 16 Feb 2005 00:26:19 +0000 (GMT) Received: from smtp104.rog.mail.re2.yahoo.com (smtp104.rog.mail.re2.yahoo.com [206.190.36.82]) by mx1.FreeBSD.org (Postfix) with SMTP id 8239A43D2D for ; Wed, 16 Feb 2005 00:26:18 +0000 (GMT) (envelope-from Mike.Jeays@rogers.com) Received: from unknown (HELO ?192.168.2.100?) (mjeays2551@24.114.152.139 with plain) by smtp104.rog.mail.re2.yahoo.com with SMTP; 16 Feb 2005 00:26:17 -0000 From: Mike Jeays To: Lowell Gilbert In-Reply-To: <44fyzx287a.fsf@be-well.ilk.org> References: <1108353173.33317.10.camel@chaucer.jeays.ca> <44fyzx287a.fsf@be-well.ilk.org> Content-Type: text/plain Message-Id: <1108513576.708.5.camel@chaucer.jeays.ca> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 15 Feb 2005 19:26:16 -0500 Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org Subject: Re: SCSI device numbers X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Feb 2005 00:26:19 -0000 On Tue, 2005-02-15 at 09:45, Lowell Gilbert wrote: > Mike Jeays 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.