Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 May 1995 08:00:41 -0700
From:      "Justin T. Gibbs" <gibbs@estienne.CS.Berkeley.EDU>
To:        Peter Dufault <dufault@hda.com>
Cc:        bmk@dtr.com, john@starfire.mn.org, questions@FreeBSD.org
Subject:   Re: formatting a scsi disk 
Message-ID:  <199505011500.IAA07183@estienne.cs.berkeley.edu>
In-Reply-To: Your message of "Mon, 01 May 1995 08:22:01 EDT." <199505011222.IAA21137@hda.com> 

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
>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 <stdlib.h>
>#include <sys/scsiio.h>
>#include <errno.h>
>#include <sys/file.h>
>
>#include <scsi.h>
>
>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
==============================================



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?199505011500.IAA07183>