Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 May 2001 18:51:22 +0200
From:      "Julian Stacey Jhs@jhs.muc.de" <jhs@jhs.muc.de>
To:        "Brian W. Buchanan" <brian@CSUA.Berkeley.EDU>, j@uriah.heep.sax.de (J Wunsch)
Cc:        hackers@FreeBSD.ORG
Subject:   Re: fd driver hacking to recover data 
Message-ID:  <200105101651.f4AGpMh58396@jhs.muc.de>
In-Reply-To: Message from "Brian W. Buchanan" <brian@CSUA.Berkeley.EDU>  of "Wed, 09 May 2001 22:04:34 PDT." <Pine.BSF.4.21.0105092153220.3063-100000@thought.adamantsys.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Brian, Joerg, cc hackers

"Brian W. Buchanan" wrote:
> Any fdc driver gurus in the house?
> 
> I have a bunch of old floppy disks with some text files I'd like to
> recover.  Many of them have errors and are unreadable past a certain point
> in the disk.  Others I can't read from at all.
> 
> The ones I can't read, period, are all 1.44MB-size floppies.  I've tried
> dd'ing from /dev/fd0c, /dev/fd0.1440, etc., but exits with "Input/Output
> Error" before copying anything.
> 
> The kernel prints:
> 
> fd0c: hard error reading fsbn 0 of 0-31 (ST0 40<abnrml> ST1 1<no_am> ST2 0
> cyl 0 hd 0 sec 1)
> 
> 
> I've been more successful reading 720K floppies from /dev/fd0.720, but
> many of them have errors that stop dd in its tracks, yielding another
> Input/Output error.
> 
> The kernel prints:
> 
> fd0c: hard error reading fsbn 1503 of 1488-1503 (ST0 44<abnrml,top_head>
> ST1 20<bad_crc> ST2 20<bad_crc> cyl 41 hd 1 sec 10)
> 
> 
> Since the files on the disks are just text, all I want to do is to be able
> to extract as many of the bits on the disk as possible, even if some of
> the bits are wrong, and then run strings over it and sort out the
> content.  I've looked at the floppy driver source and it seems to be
> incredibly low-level, i.e. it turns the drive motor on and off, even.  Can
> someone familiar with the driver give me some pointers as to what I'd have
> to modify to let it 1) read those 1.44MB disks, and 2) tolerate data
> errors?

I have a program that will rescue your data !
It runs on DOS-3.2 & FreeBSD-any BUT the rescue component only runs on DOS
(however at least you can compile & play with it on BSD to get used to it).

I have no idea if the FreeBSD ports DOS emulators allow access to floppy
hardware or not ?  If not, the other options are:
-  to boot with DOS to run my program,
-  or modify the FreeBSD fd driver to pass the buffer on error.

By chance my program was just being discussed on another list, Here's extracts:
---------------------
> Message-Id: <200105072157.f47LvVs42257@jhs.muc.de>
> To: freebsd-scsi@FreeBSD.ORG
> Cc: pechter@ureach.com, "Ron Klinkien" <rklinkien@chello.nl>
> Subject: Re: Recovered data with positive head offset field replaceable unit msg
> Date: Mon, 07 May 2001 23:57:31 +0200
> From: "Julian Stacey Jhs@jhs.muc.de" <jhs@jhs.muc.de>
> Sender: owner-freebsd-scsi@FreeBSD.ORG
> 
> <stuff deleted>
> 
> It's possible to recover most text data from bad floppies by repeat
> scanning, even without varying the offset, even with failing CRCs:
> I wrote a program that does that in ~87
>   http://bim.bsn.com/~jhs/src/bsd/jhs/bin/public/valid/valid.c & valid.1
> (The recover part of the program's now larger functionality runs
> only on DOS though, not on Unix, as DOS passes filled buffers back
> even when read() returns CRC error, whereas FreeBSD discards the
> buffer content on error.
> 
> Julian
---------------------
> Date: Wed, 9 May 2001 09:11:58 +0200 (MET DST)
> Message-Id: <200105090711.f497Bwr27407@uriah.heep.sax.de>
> From: j@uriah.heep.sax.de (J Wunsch)
> Subject: Re: Recovered data with positive head offset field replaceable unit msg
> To: freebsd-scsi@FreeBSD.ORG
> 
> Arranging for a `read track' functionality in the FreeBSD floppy
> driver should be possible.  This will return you the entire /bit/
> contents of the track, no CRC checks &c.  Only the first sector ID
> will be synchronized, the remainder of the track is returned as it
> appears on the floppy; you need to manually bit-dealign and perhaps
> bit-reverse the remaining data.
---------------------

Hi Joerg,
Thanks,
Doing a track was what Greg L suggested to brian@CSUA.Berkeley.EDU,
however that sounds like more work, & not optimal maybe ?
In 1987 with DOS I was lucky, I did a read() on each sector, copied each
sector with a good CRC to hard disc, & only repeat tried
bad floppy sectors, doing a statistical average of each bit,
(if none of the reads gave me a good CRC).
(I also did multi sectors initially, then dropped to single sectors on error).
To avoid head (*) wear & increase chance of a good CRC to the max,
I'd prefer to stick to doing single sector seeks & reads, not tracks.
(*) Forget media wear: I reccomend anyone who uses my valid.c
    to read odd sectors a few hundred/thousand times off already bad media,
    to discard media after reading :-) 
In an ideal world with lots of free time ;-) Brian Julian or Joerg 
would extend src/sys/isa/fd.c to support
http://bim.bsn.com/~jhs/src/bsd/jhs/bin/public/valid/valid.c	:-)

-
Julian Stacey     Unix Consultant - Munich Germany     http://bim.bsn.com/~jhs/
 Ihr Rauchen => mein allergischer Kopfschmerz !  Kau/Schnupftabak probieren !
	Like Linux ?	Then also look at FreeBSD with its 5000+ packages !

























sector, & though I got -1, the sector data was there (even if mangled)

Julian
-
Julian Stacey     Unix Consultant - Munich Germany     http://bim.bsn.com/~jhs/
 Ihr Rauchen => mein allergischer Kopfschmerz !  Kau/Schnupftabak probieren !
	Like Linux ?	Then also look at FreeBSD with its 5000+ packages !

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105101651.f4AGpMh58396>