2001-05-14 20:22:49 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2001 Joerg Wunsch
|
|
|
|
.\"
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
|
|
|
.\"
|
|
|
|
.Dd May 14, 2001
|
2001-05-16 17:09:00 +00:00
|
|
|
.Os
|
2001-05-14 20:22:49 +00:00
|
|
|
.Dt FDREAD 1
|
|
|
|
.Sh NAME
|
|
|
|
.Nm fdread
|
|
|
|
.Nd read floppy disks
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2001-05-16 17:09:00 +00:00
|
|
|
.Op Fl qr
|
2001-05-14 20:22:49 +00:00
|
|
|
.Op Fl d Ar device
|
|
|
|
.Op Fl f Ar fillbyte
|
|
|
|
.Op Fl o Ar file
|
2001-06-26 22:17:21 +00:00
|
|
|
.Nm
|
|
|
|
.Op Fl d Ar device
|
|
|
|
.Fl I Ar numsects
|
|
|
|
.Op Fl t Ar trackno
|
2001-05-14 20:22:49 +00:00
|
|
|
.Sh DESCRIPTION
|
2001-05-16 17:09:00 +00:00
|
|
|
The
|
|
|
|
.Nm
|
2004-07-02 23:13:00 +00:00
|
|
|
utility reads floppy disks.
|
|
|
|
Effective read blocking based on the track
|
2001-05-14 20:22:49 +00:00
|
|
|
size is performed, and floppy-specific error recovery of otherwise
|
|
|
|
bad blocks can be enabled.
|
|
|
|
.Pp
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
2001-05-16 17:09:00 +00:00
|
|
|
.Nm
|
2002-04-20 12:27:18 +00:00
|
|
|
utility
|
2001-05-14 20:22:49 +00:00
|
|
|
will always read an entire floppy medium, and write its contents to
|
2004-07-02 23:13:00 +00:00
|
|
|
the respective output file.
|
|
|
|
Unlike other tools like
|
2001-05-14 20:22:49 +00:00
|
|
|
.Xr dd 1 ,
|
|
|
|
.Nm
|
|
|
|
automatically uses a read block size that is more efficient than
|
|
|
|
reading single blocks (usually one track of data at a time), but
|
|
|
|
falls back to reading single floppy sectors in case of an input/output
|
|
|
|
error occurred, in order to obtain as much valid data as possible.
|
|
|
|
While
|
|
|
|
.Nm
|
|
|
|
is working, kernel error reporting for floppy errors is turned off, so
|
|
|
|
the console and/or syslog are not flooded with kernel error messages.
|
2001-05-16 17:09:00 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility accepts the following options:
|
|
|
|
.Bl -tag -width indent
|
2001-05-14 20:22:49 +00:00
|
|
|
.It Fl q
|
2004-07-02 23:13:00 +00:00
|
|
|
Turn on quiet mode.
|
|
|
|
By default, the medium parameters of the device
|
2001-05-14 20:22:49 +00:00
|
|
|
are being written to standard error output, progress will be indicated
|
|
|
|
by the approximate number of kilobytes read so far, and errors will be
|
|
|
|
printed out in detail, including the information about the location of
|
2004-07-02 23:13:00 +00:00
|
|
|
recovered data in the output.
|
|
|
|
In quiet mode, none of these messages
|
2001-05-14 20:22:49 +00:00
|
|
|
will be generated.
|
|
|
|
.It Fl r
|
2004-07-02 23:13:00 +00:00
|
|
|
Enable error recovery.
|
|
|
|
By default,
|
2001-05-14 20:22:49 +00:00
|
|
|
.Nm
|
|
|
|
stops after the first unrecovered read error, much like
|
|
|
|
.Xr dd 1
|
2004-07-02 23:13:00 +00:00
|
|
|
does.
|
|
|
|
In recovery mode, however, one of two recovery actions will be
|
2001-05-14 20:22:49 +00:00
|
|
|
taken:
|
2001-05-16 17:09:00 +00:00
|
|
|
.Bl -bullet
|
2001-05-14 20:22:49 +00:00
|
|
|
.It
|
|
|
|
If the error was a CRC error in the data field, the
|
|
|
|
kernel is told to ignore the error, and data are transferred to the
|
|
|
|
output file anyway.
|
2001-05-16 17:09:00 +00:00
|
|
|
.Bf -emphasis
|
|
|
|
Note that this will cause the erroneous data
|
|
|
|
to be included in the output file!
|
|
|
|
.Ef
|
2001-05-14 20:22:49 +00:00
|
|
|
Still, this is the best recovery action that can be taken at all.
|
|
|
|
.It
|
2005-02-13 22:25:33 +00:00
|
|
|
All other errors are really fatal (usually, the FDC did not find the
|
2001-05-14 20:22:49 +00:00
|
|
|
sector ID fields), thus a dummy block with fill
|
|
|
|
bytes will be included in the output file.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Unless operating in quiet mode, the action taken and the location of
|
|
|
|
the error in the output file will be displayed.
|
|
|
|
.It Fl d Ar device
|
|
|
|
Specify the input floppy device, defaulting to
|
|
|
|
.Pa /dev/fd0 .
|
|
|
|
The parameter
|
|
|
|
.Ar device
|
|
|
|
must be a valid floppy disk device.
|
|
|
|
.It Fl f Ar fillbyte
|
|
|
|
Value of the fill byte used for dummy blocks in the output file in
|
2004-07-02 23:13:00 +00:00
|
|
|
recovery mode.
|
|
|
|
Defaults to
|
2001-05-14 20:22:49 +00:00
|
|
|
.Ql 0xf0 .
|
|
|
|
(Mnemonic:
|
|
|
|
.Dq foo . )
|
|
|
|
The value can be specified using the usual C language notation of
|
|
|
|
the number base.
|
|
|
|
.It Fl o Ar file
|
|
|
|
Specify the output file to be
|
|
|
|
.Ar file .
|
|
|
|
By default, the data will be written to standard output.
|
2001-06-26 22:17:21 +00:00
|
|
|
.It Fl I Ar numsects
|
|
|
|
Read
|
|
|
|
.Ar numsects
|
|
|
|
sector ID fields, and write out their contents to standard output.
|
|
|
|
Each sector ID field contains recorded values for the cylinder number
|
|
|
|
.Pq Ql C ,
|
|
|
|
the head number
|
|
|
|
.Pq Ql H ,
|
|
|
|
the record number (sector number starting with 1)
|
|
|
|
.Pq Ql R ,
|
|
|
|
and the
|
|
|
|
.Em sector shift value
|
2001-07-05 07:21:28 +00:00
|
|
|
(0 = 128 bytes, 1 = 256 bytes, 2 = 512 bytes, 3 = 1024 bytes)
|
2001-06-26 22:17:21 +00:00
|
|
|
.Pq Ql N .
|
|
|
|
The
|
|
|
|
.Fl I
|
|
|
|
option is mutually exclusive with all other options except
|
|
|
|
.Fl d Ar device
|
|
|
|
and
|
|
|
|
.Fl t Ar trackno .
|
|
|
|
.It Fl t Ar trackno
|
|
|
|
Specify the track number (cylinder number * number of heads + head
|
|
|
|
number) to read the sector ID fields from; only allowed together with
|
|
|
|
the
|
|
|
|
.Fl I Ar numsects
|
|
|
|
option.
|
2001-05-14 20:22:49 +00:00
|
|
|
.El
|
|
|
|
.Sh FILES
|
2001-05-16 17:09:00 +00:00
|
|
|
.Bl -tag -width /dev/fd0
|
2001-05-14 20:22:49 +00:00
|
|
|
.It Pa /dev/fd0
|
|
|
|
Default device to read from.
|
2001-05-16 17:09:00 +00:00
|
|
|
.El
|
2005-01-17 07:44:44 +00:00
|
|
|
.Sh EXIT STATUS
|
2002-04-20 12:27:18 +00:00
|
|
|
The
|
2001-05-16 17:09:00 +00:00
|
|
|
.Nm
|
2002-04-20 12:27:18 +00:00
|
|
|
utility sets the exit value according to
|
2001-05-14 20:22:49 +00:00
|
|
|
.Xr sysexits 3 .
|
|
|
|
In recovery mode, the exit value will be set to
|
2001-05-16 17:09:00 +00:00
|
|
|
.Dv EX_IOERR
|
2001-05-14 20:22:49 +00:00
|
|
|
if any error occurred during processing (even in quiet mode).
|
2005-01-17 07:44:44 +00:00
|
|
|
.Sh DIAGNOSTICS
|
2001-05-14 20:22:49 +00:00
|
|
|
Unless running in quiet mode, upon encountering an error, the status
|
|
|
|
of the floppy disc controller (FDC) will be printed out, both in
|
|
|
|
hexadecimal form, followed by a textual description that translates
|
|
|
|
those values into a human-readable form for the most common error
|
|
|
|
cases that can happen in a PC environment.
|
|
|
|
.Pp
|
|
|
|
The FDC error status includes the three FDC status registers
|
|
|
|
.Ql ST0 ,
|
|
|
|
.Ql ST1 ,
|
|
|
|
and
|
|
|
|
.Ql ST2 ,
|
|
|
|
as well as the location of the error (physical cylinder, head, and sector
|
|
|
|
number, plus the
|
|
|
|
.Dq sector shift value ,
|
2004-07-02 23:13:00 +00:00
|
|
|
respectively).
|
|
|
|
See the manual for the NE765 or compatible for details
|
2001-05-14 20:22:49 +00:00
|
|
|
about the status register contents.
|
|
|
|
.Pp
|
|
|
|
The FDC's status is then examined to determine whether the error is
|
2004-07-02 23:13:00 +00:00
|
|
|
deemed to be recoverable.
|
|
|
|
If error recovery was requested, the
|
2001-05-14 20:22:49 +00:00
|
|
|
location of the bad block in the output file is indicated by its
|
2004-07-02 23:13:00 +00:00
|
|
|
(hexadecimal) bounds.
|
|
|
|
Also, a summary line indicating the total number
|
2001-05-14 20:22:49 +00:00
|
|
|
of transfer errors will be printed before exiting.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr dd 1 ,
|
|
|
|
.Xr fdwrite 1 ,
|
2001-05-16 17:09:00 +00:00
|
|
|
.Xr sysexits 3 ,
|
|
|
|
.Xr fdc 4 ,
|
|
|
|
.Xr fdcontrol 8
|
2001-05-14 20:22:49 +00:00
|
|
|
.Sh HISTORY
|
2001-05-16 17:09:00 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility was written mainly to provide a means of recovering at least some of
|
2001-05-14 20:22:49 +00:00
|
|
|
the data on bad media, and to obviate the need to invoke
|
|
|
|
.Xr dd 1
|
|
|
|
with too many hard to memorize options that might be useful to handle
|
|
|
|
a floppy.
|
|
|
|
.Pp
|
|
|
|
The command appeared in
|
|
|
|
.Fx 5.0 .
|
|
|
|
.Sh AUTHORS
|
|
|
|
Program and man page by
|
2001-05-16 17:09:00 +00:00
|
|
|
.An J\(:org Wunsch .
|
2001-05-14 20:22:49 +00:00
|
|
|
.Sh BUGS
|
|
|
|
Concurrent traffic on the second floppy drive located at the same FDC
|
|
|
|
will make error recovery attempts pointless, since the FDC status
|
|
|
|
obtained after a read error occurred cannot be guaranteed to actually
|
2004-07-02 23:13:00 +00:00
|
|
|
belong to the erroneous transfer.
|
|
|
|
Thus using option
|
2001-05-14 20:22:49 +00:00
|
|
|
.Fl r
|
|
|
|
is only reliable if
|
|
|
|
.Ar device
|
|
|
|
is the only active drive on that controller.
|
|
|
|
.Pp
|
|
|
|
No attempt beyond the floppy error retry mechanism of
|
|
|
|
.Xr fdc 4
|
|
|
|
is made in order to see whether bad sectors could still be read
|
|
|
|
without errors by trying multiple times.
|
|
|
|
.Pp
|
|
|
|
Bits that are (no longer) available on the floppy medium cannot be
|
|
|
|
guessed by
|
2001-05-16 17:09:00 +00:00
|
|
|
.Nm .
|