From owner-freebsd-questions Mon May 1 08:01:19 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id IAA26751 for questions-outgoing; Mon, 1 May 1995 08:01:19 -0700 Received: from estienne.cs.berkeley.edu (estienne.CS.Berkeley.EDU [128.32.42.147]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id IAA26745 for ; Mon, 1 May 1995 08:01:17 -0700 Received: from localhost (localhost [127.0.0.1]) by estienne.cs.berkeley.edu (8.6.11/8.6.9) with SMTP id IAA07183; Mon, 1 May 1995 08:00:41 -0700 Message-Id: <199505011500.IAA07183@estienne.cs.berkeley.edu> X-Authentication-Warning: estienne.cs.berkeley.edu: Host localhost didn't use HELO protocol To: Peter Dufault cc: bmk@dtr.com, john@starfire.mn.org, questions@FreeBSD.org Subject: Re: formatting a scsi disk In-reply-to: Your message of "Mon, 01 May 1995 08:22:01 EDT." <199505011222.IAA21137@hda.com> Date: Mon, 01 May 1995 08:00:41 -0700 From: "Justin T. Gibbs" Sender: questions-owner@FreeBSD.org Precedence: bulk >bmk@dtr.com writes: >> >> >> > bmk@dtr.com writes: >> > > >> > > Can't get it to work here, any clues? >> >> > It turns out that commands with no data have never worked via "scsi" >> > (yikes). That is fixed in -current, and I'm on to two new problems: >> >> > 1. We need to be able to specify the timeout (the default is 2 >> > seconds, which is not going to work well for formatting your disks) >> >> > 2. We need to account for disks that can't be opened by the disk driver >> > before formatting. >> >> So... I guess my next question is how can I reformat a problematic SCSI >> disk since I'm running SNAP-0412 and not current. The controller is a >> Buslogic 445 - and they don't provide a SCSI format utility. >> >> If it's necessary, I can format the disk on an Adaptec 1542 (which does >> have a formatter), but I'd rather not do that, since it'd involve >> disassembling two machines. > >Try this. It should work if you can open the disk. If you can't >you'll have to either upgrade to -current when I fix that problem (and I >haven't yet) or you'll have to use your 1542. > >This will do a "Test Unit Ready". >You have to change the "0 0 0 0 0 0" to "4 0 0 0 0 0" to get a format. > >Let me know how it works out. > >#include >#include >#include >#include > >#include > >int main(int argc, char *argv[]) >{ > int fid; > scsireq_t *scsireq; > > if (argc != 2) { > fprintf(stderr, "Usage: %s device\n", argv[0]); > exit(-1); > } > > if ( (fid = scsi_open(argv[1], O_RDWR)) == -1) { > perror(argv[1]); > exit(errno); > } > > scsireq = scsireq_build(scsireq_new(), 0, 0, 0, > "0 0 0 0 0 0", /* Change to "4 0 0 0 0 0" for format */ > 0); > scsireq->timeout = 20 * 60 * 1000; /* 20 minutes in ms */ > > if (scsireq_enter(fid, scsireq) == -1) { > scsi_debug(stderr, -1, scsireq); > exit(errno); > } > > exit(0); >} These types of programs are really useful. Is there any interest in having a "scsi-format" or "mode-page-tweeker" in the distribution? The more I can do in FreeBSD, the less often I have to dust off my DOS floppy... :) >-- >Peter Dufault Real Time Machine Control and Simulation >HD Associates, Inc. Voice: 508 433 6936 >dufault@hda.com Fax: 508 433 5267 -- Justin T. Gibbs ============================================== TCS Instructional Group - Programmer/Analyst 1 Cory | Po | Danube | Volga | Parker | Torus ==============================================