[comp.sys.ibm.pc] low level format

cek@princeton.UUCP (Craig Kolb) (11/09/86)

(Sorry if you see this twice -- I tried canceling the previous
article, but who knows...)

I have a standard, boring IBM XT with a standard, boring 10M hard disk that
is in desperate need of low-level formatting.  I know that there is a way to
do this via 'debug' and the controller, but this doesn't seem to work with
my "old-style" controller.  I keep seeing references to 'hdformat',
however.  Could somebody enlighten me/send me a copy of 'hdformat' or the
equivalent?  My ailing hard disk would greatly appreciate it!  I'll post a
followup if appropriate blahblahblah.

Thanks...
-- 
Craig Kolb
UUCP: princeton!cek
BITNET: 6085716@PUCC.BITNET (if you must)

"Today must be thursday.  I never could get the hang of thursdays."

uffe@log-hb.UUCP (Ulf Hallgren) (09/15/87)

HI,
I own a Compaq portable computer with a 20MB Seagate drive. 
The controler is a Xebec. My question is: How do you low level format
the disk. Do you have to enter debug and set up som registers and jump
to a secret address ?!!

Ulf Hallgren

creps@silver.bacs.indiana.edu (09/17/87)

   I just posted some info on this for a response to the posting by mechgam
(C: not a valid drive). It might work for your controller as well. Just
check my response to tha message.
-	-	-	-	-	-	-	-	-
Steve Creps on the VAX 8650 running Ultrix 2.0-1 at Indiana University.
	creps@silver.bacs.indiana.edu
Cowhand: "How 'bout some more beans, Mr. Taggert?"
Taggert (Slim Pickens): "Hell, I'd say you boys have had enough already!"

jons@islenet.UUCP (Jonathan Spangler) (09/20/87)

try this:

A>debug
-g=c800:5      <--- this works for most controllers

  *OR*
-g=c800:ccc    <--- this works for Adaptec controllers

Your other choice here is to look at a hard disk utility called
"Disk Manager", which I've used on a number of different configurations,
including XT's, AT's, 386's; 20meg, 40meg, 80meg; RLL-AT controllers,
standard WD-16 bit controllers, Konan, DTC, etc.

I like it alot!

Aloha,

-- 
Jonathan Spangler
UUCP:         {ihnp4,vortex,dual}!islenet!jons
OPUS/FIDONET: Sysop@(12/6) HTCS BBS (808)531-2659, 24 hrs., Honolulu

martin@iris.ucdavis.edu (Bruce K. Martin Jr.) (09/25/87)

I'm using a 'true blue' IBM PC XT that has developed some bad sectors on the
hard disk.  (10Mb disk, IBM controller).  Does anyone know where I can get
a program to do a low level format on the disk (don't say format c: -- it
doesn't do a real format).  If someone has such a program, do you think you
could uuencode it and mail it to me? (assuming it is public domain...)

Thanks a million!


			...bruce

Bruce K. Martin,  UC. Davis, Div. of Computer Science
martin@iris.ucdavis.edu  --or--  {ucbvax | lll-crg}!ucdavis!iris!martin

alexande@drivax.UUCP (Mark Alexander) (09/28/87)

Several people have asked for something like this, so here's
a program to do a low-level format for the hard disk on a PC/XT.
It tells you what the drive parameters appear to be, then asks
you a couple of times if you're really sure you want to destroy
the disk, so it's safe to use.

The program definitely works on PC/XTs with the Xebec/IBM controller.
It was also tested four years ago with some WD and Adaptec controllers,
but may not work with current models.  It doesn't work on ATs
because they took out the Format Drive command from the BIOS,
for some reason.

Please ignore the copyright notice.  I wrote this years ago for
a company that no longer exists.  Sorry, I've lost the source,
but it's a MASM program that's easy to disassemble.  The core
of the program could be restated by the following four lines of code:
	mov	dx,80h		; drive c, use 81 for drive d
	mov	cx,1		; start track 0, sector 1
	mov	ax,706h		; format drive (AH), interleave 6 (AL)
	int	13h		; call the Fixed Disk BIOS
In fact, you could just use DEBUG and enter this program without
all the frills.
------------------------------ Cut here ------------------------------
begin 664 fdfmt.com
MNN\!Z+T#N```CL"[!`&,R([8)HM7`B:+/X/Z`'4#Z<,`CL*Z'`+HF@/HG`,L
M,#P"<@/IM`"B[@$\`+HB`^QU!-#HT.@D`[0`T>#1X-'@T>`#^+I@`B:+!>B`
M`[J$`B:*10*T`.AT`[JH`B:+10/H:@.ZS`(FBT4%Z&`#NO`")HI%![0`Z%0#
MNA0#)HI%"+0`Z$@#NC@#Z"H#Z"P#/%FZ?`-U/+K!`^@:`^@<`SQ9NK($=2RZ
M"@3H"@.X`,B.P+L``(H6[@&V`(#*@+@`#\T3N0$`N`8'S1.Z901S`[J?!.CA
M`LT@NC$$Z_:Z00+K\0!&1$9-5"!6,2XQ("`H0RD@0T]065))1TA4(%)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\,`````````
`
end
-- 
Mark Alexander	...{hplabs,seismo,sun,ihnp4}!amdahl!drivax!alexande
"Bob-ism: the Faith that changes to meet YOUR needs." -- Bob

peter@csd4.milw.wisc.edu (Peter J Diaz de Leon) (10/07/87)

I am running a Compaq Deskpro 286 which is an AT compatable.  I would like
to cjange the interleave on my hard drive from 2:1 to 1:1.  I have a 
Miniscribe 20MB and a Compaq HD controler installed.  Does anyone have
some software for the AT that will allow me to LOW LEVEL format
my HD with the new interleave.

				Much Thanks
				 Peter
==============================================================================
ARPA: dpeter@csd4.milw.wisc.edu      USMAIL: Peter J. Diaz de Leon
      peter@uwm-cs.milw.wisc.edu             7411 W. Warnimont Ave.
					     Milwaukee, WI. 53220

UUCP: ihnp4!uwmcsd1!uwm-evax!peter   ICBM:   43 4 58 N / 87 55 52 W
==============================================================================

enchant@oliveb.UUCP (Dan Crocker) (10/08/87)

In article <3104@uwmcsd1.UUCP>, peter@csd4.milw.wisc.edu (Peter J Diaz de Leon) writes:
> I am running a Compaq Deskpro 286 which is an AT compatable.  I would like
> to cjange the interleave on my hard drive from 2:1 to 1:1.  I have a 
> Miniscribe 20MB and a Compaq HD controler installed.  Does anyone have
> some software for the AT that will allow me to LOW LEVEL format
> my HD with the new interleave.
> 

I don't think you really want to do this.
Unless the controller is specifically designed to allow 1:1 (I don't think
this one is), then using 1:1 will kill your disk performance.  If you are
using the compaq controller that I think you are, then 2:1 is the best you
can do.  The capability to run 1:1 is a big deal (from a marketing point of
view) and is usually very heavily advertised in the system documentation.  If
1:1 is not mentioned, then you proabaly need to stay with 2:1.

				dan
-- 
Here comes the supernatural anesthetist
If he wants you to snuff it
All he has to do is puff it
He's such a fine dancer

peter@csd4.milw.wisc.edu (Peter J Diaz de Leon) (10/09/87)

I would like to thank all the people who respondeod to my question
regarding changing my interleave from 2:1 to 1:1 on my Compaq 286.

The info I received was very helpful.

				Thanks to everyone
				    Peter

==============================================================================
ARPA: dpeter@csd4.milw.wisc.edu      USMAIL: Peter J. Diaz de Leon
      peter@uwm-cs.milw.wisc.edu             7411 W. Warnimont Ave.
					     Milwaukee, WI. 53220

UUCP: ihnp4!uwmcsd1!uwm-evax!peter   ICBM:   43 4 58 N / 87 55 52 W
==============================================================================

hollen@mana.megatek.uucp (Dion Hollenbeck) (10/09/87)

In article <6582@oliveb.UUCP> enchant@oliveb.UUCP (Dan Crocker) writes:
>In article <3104@uwmcsd1.UUCP>, peter@csd4.milw.wisc.edu (Peter J Diaz de Leon) writes:
>> I am running a Compaq Deskpro 286 which is an AT compatable.  I would like
>> to cjange the interleave on my hard drive from 2:1 to 1:1.  I have a 
>> Miniscribe 20MB and a Compaq HD controler installed.  Does anyone have
>> some software for the AT that will allow me to LOW LEVEL format
>> my HD with the new interleave.
>> 
>
>I don't think you really want to do this.
>Unless the controller is specifically designed to allow 1:1 (I don't think
>this one is), then using 1:1 will kill your disk performance.  If you are
>using the compaq controller that I think you are, then 2:1 is the best you
>can do.  
 
Sorry Dan, but he should at least try it, you never know.  Documentation on
my hard disk/controller suggested 4:1 was the best I could expect.  After
trying successively closer interleaves, disk performance went to s--t at
1:1 but was super at 2:1.  Peter, try successively closer interleave formats
followed with a test of disk performance such as included with Norton Utils.
When you have gone one too far, it will be immediately apparent, then go
back up one.  It may take a lot of time, but it sure is worth it.




	Dion Hollenbeck             (619) 455-5590 x2814
	Megatek Corporation, 9645 Scranton Road, San Diego, CA  92121
			    ames!scubed!
		{sdcsvax,hplabs}!hp-sdd!megatek!hollen
			 sdcsvax!esosun!

alexande@drivax.UUCP (Mark Alexander) (10/14/87)

In article <3104@uwmcsd1.UUCP> peter@csd4.milw.wisc.edu (Peter J Diaz de Leon) writes:
>I am running a Compaq Deskpro 286 which is an AT compatable.  I would like
>to change the interleave on my hard drive from 2:1 to 1:1.  I have a 
>Miniscribe 20MB and a Compaq HD controler installed.  Does anyone have
>some software for the AT that will allow me to LOW LEVEL format
>my HD with the new interleave.

This question seems to come up quite a bit, so I am enclosing here a program
that can be adapted to do what you want.  It does a 2:1 interleave format,
but the interleave table could easily be changed to do 1:1.

Warning: this is a quick and dirty program.  It's smart enough to
query the BIOS for the disk parameters it needs; it asks you if
you're really sure you want to zap the disk; and it prints a dot at
every cylinder to show you progress.  But error handling is wretched
(i.e. a disk error aborts the program).

------------------------------ Cut Here ------------------------------
; ATFMT.ASM - low level hard disk format for PC-AT.
; Create DOSFM.COM as follows:
;	masm atfmt;
;	link atfmt;
;	exe2bin atfmt.exe atfmt.com
;	del atfmt.exe

cgroup	group	code
code	segment
	assume	cs:cgroup,ds:cgroup,es:cgroup

	org	100h

start:
	jmp	init

; Data

maxhead	db	?
maxcyl	dw	?

head	db	0
cyl	dw	0

warn	db	'Low-level hard disk format for AT.',13,10
	db	'Are you sure you want to destroy your disk (y/n)? $'
crlf	db	13,10,'$'
diskerr	db	13,10,'Disk error, format aborted',13,10,'$'

init:
	mov	dx,offset warn		; print warning message
	mov	ah,9
	int	21h
	mov	ah,1			; wait for key to be hit
	int	21h
	push	ax			; save the key
	mov	dx,offset crlf		; print new line
	mov	ah,9
	int	21h
	pop	ax			; get back the key
	cmp	al,'y'			; if Y or y, continue
	je	continue
	cmp	al,'Y'
	jne	done
continue:
	mov	ah,8			; get drive parameters
	mov	dl,80h			;  for drive c:
	int	13h
	jc	error
	and	cl,0c0h			; mask off max sector
	mov	maxcyl,cx
	mov	maxhead,dh

dotrack:
	mov	dh,head			; get head number
	mov	cx,cyl			; get cylinder number
	mov	bx,offset buff		; track interleave table address
	mov	dl,80h			; drive C
	mov	ah,5			; format track
	int	13h			; call bios
	jc	error
	
; Check for head overrun

	mov	dh,head
	cmp	dh,maxhead		; done all heads on one cylinder?
	je	nextcyl			; yes - go to next cylinder
	inc	dh			; no - go to next head
	mov	head,dh
	jmp	dotrack			; and format next track

; Check for cylinder overrun.  This is tricky since ch contains
; the low eight bits, and bits <7:6> of cl contain the high two bits.

nextcyl:
	mov	head,dh
	mov	head,0
	mov	cx,cyl
	cmp	cx,maxcyl		; done all cylinders?
	je	done			; yes - we're done
	inc	ch			; low byte wrapped around?
	jnz	nowrap			; no, skip incrementing high byte
	add	cl,40h			; increment high two bits
nowrap:
	mov	cyl,cx			; save new cylinder number
	mov	dl,'.'			; write a dot to screen
	mov	ah,2			;  to let them know we're
	int	21h			;  doing something
	jmp	dotrack			; go do next cylinder
	
error:
	mov	dx,offset diskerr	; print error message
	mov	ah,9
	int	21h
	mov	ax,4c01h		; error return
	int	21h

done:	mov	ax,4c00h		; normal return
	int	21h
	

; Track interleave table.  Quoting from the COMPAQ 386 Technical
; Reference, page 9-14:
;	"The table contains 2 bytes per sector on the track.
;	The first byte is 0 if the sector is to be formatted
;	normally, or 80h if the sector is to be formatted bad.
;	The second byte is the logical sector number of the
;	sector..."dd" is a "don't care" byte used to make up a
;	total of 512 bytes."
; The table shown here is for an interleave factor of 2.
; Tables for other interleaves are left as an exercise for the reader.

buff	db	0,1,0,0ah,0,2,0,0bh,0,3,0,0ch
	db	0,4,0,0dh,0,5,0,0eh,0,6,0,0fh
	db	0,7,0,10h,0,8,0,11h,0,9
	
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh

	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh

	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh

	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh
	dw	0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh,0ddddh

code	ends

	end	start
-- 
Mark Alexander	...{hplabs,seismo,sun,ihnp4}!amdahl!drivax!alexande
"Bob-ism: the Faith that changes to meet YOUR needs." -- Bob

mcormick@unm-la.UUCP (Patrick McCormick) (03/24/89)

	Hi,

	I've been trying to write some code to do a low level format
	of a hard disk on an XT but, I haven't been able to tell if
	has worked correctly or not.  (I'm running a developmental
	operating system and the disk got trashed and I want to make
	sure I start with a clean setup.)  Does someone out there 
	have some code that does the job?  How do I tell if the disk
	has been formatted correctly.  (Other than the return value in
	AX for int 13?)

	Any help would be appreicated.

	Thanks,

	Pat McCormick
	-------------------------------------------
	mcormick@unm-la.LANL.GOV
	lanl!unm-la!mcormick@uunet.uu.net
	--or--
	uunet.UU.NET!unm-la!mcormick@cs.utexas.edu
	------------------------------------------

ross@mscf.med.upenn.edu (10/25/89)

Does anybody know the code for doing a low level format on the original 
Seagate 20 meg hard drive that was supplied with the IBM XT.

Thanks for your assistance.
-- 

			--- Andy Ross ---
                    University of Pennsylvania
		 Medical School Computer Facility

phil@diablo.amd.com (12/08/89)

I'm looking for some suggestions on low level formatters and bad block
handling. My WD1006 does have a formatter in its controller BIOS but
some of my other machines don't have this feature. Also I'm not very
impressed with the WD's formatter. On some disks it gets an error
after doing a verify or defect scan for a while (reading an IO
register?) and quits. (so I don't use those disks but I wish I could.)

Spinrite II is neat but it only does REformatting. It also sometimes
gets stuck handling a bad block and never goes on or stops for ESC.  I
got Disk Technician Advanced only to find it can't deal with
partitions > 32 megabytes.  (what bozos!) I had trouble with dm also.
I wasn't sure that the bad blocks it found were being seen by DOS.
(I'm pretty sure Spinrite II didn't cooperate with it anyway.) Any
other ideas? 

Just how do/should bad blocks be handled? 
--
Phil Ngai, phil@diablo.amd.com		{uunet,decwrl,ucbvax}!amdcad!phil
AT&T Unix System V.4: Berkeley Unix for 386 PCs!

karl@ddsw1.MCS.COM (Karl Denninger) (12/09/89)

>Item 7338 (0 resps) by phil at diablo.amd.com on Fri 08 Dec 89 11:21
>[<No Identification>]    Subject: low level format
>(20 lines)
>
>
>I'm looking for some suggestions on low level formatters and bad block
>handling. My WD1006 does have a formatter in its controller BIOS but
>some of my other machines don't have this feature. Also I'm not very
>impressed with the WD's formatter. On some disks it gets an error
>after doing a verify or defect scan for a while (reading an IO
>register?) and quits. (so I don't use those disks but I wish I could.)

Yuck.  Your disk has some >serious< problems with retaining information if
you get an I/O error in the registers.  I've seen this too, and if you get
a list of the codes (call WD or get a manual for details) you'll find that
most of them are of the ilk "seek not completed" or "no data address mark"
on disk (!)

>Spinrite II is neat but it only does REformatting. It also sometimes
>gets stuck handling a bad block and never goes on or stops for ESC.  I
>got Disk Technician Advanced only to find it can't deal with
>partitions > 32 megabytes.  (what bozos!) I had trouble with dm also.
>I wasn't sure that the bad blocks it found were being seen by DOS.
>(I'm pretty sure Spinrite II didn't cooperate with it anyway.) Any
>other ideas? 

DM should work IF it is the full (not just "one manufacturer") version.  So
should Speedstor (Storage Dimensions).  We use both.

Bad blocks should just be marked as defective (the data address mark is
changed to do this).  An attempted read on that sector then returns "deleted
data record" in the flags, which DOS will catch during the high level format
and mark the block as unavailable.

--
Karl Denninger (karl@ddsw1.MCS.COM, <well-connected>!ddsw1!karl)
Public Access Data Line: [+1 708 566-8911], Voice: [+1 708 566-8910]
Macro Computer Solutions, Inc.  "Quality Solutions at a Fair Price"