From owner-freebsd-questions Mon May 1 05:23:52 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id FAA22573 for questions-outgoing; Mon, 1 May 1995 05:23:52 -0700 Received: from hda.com (hda.com [199.232.40.182]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id FAA22567 for ; Mon, 1 May 1995 05:23:48 -0700 Received: (dufault@localhost) by hda.com (8.6.9/8.3) id IAA21137; Mon, 1 May 1995 08:22:01 -0400 From: Peter Dufault Message-Id: <199505011222.IAA21137@hda.com> Subject: Re: formatting a scsi disk To: bmk@dtr.com Date: Mon, 1 May 1995 08:22:01 -0400 (EDT) Cc: john@starfire.mn.org, questions@FreeBSD.org In-Reply-To: <199505011151.EAA14572@dtr.com> from "bmk@dtr.com" at May 1, 95 04:51:29 am X-Mailer: ELM [version 2.4 PL24] Content-Type: text Content-Length: 2001 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); } -- Peter Dufault Real Time Machine Control and Simulation HD Associates, Inc. Voice: 508 433 6936 dufault@hda.com Fax: 508 433 5267