xref: /freebsd/usr.sbin/fdread/fdread.1 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1b97809a7SJoerg Wunsch.\"
2b97809a7SJoerg Wunsch.\" Copyright (c) 2001 Joerg Wunsch
3b97809a7SJoerg Wunsch.\"
4b97809a7SJoerg Wunsch.\" All rights reserved.
5b97809a7SJoerg Wunsch.\"
6b97809a7SJoerg Wunsch.\" Redistribution and use in source and binary forms, with or without
7b97809a7SJoerg Wunsch.\" modification, are permitted provided that the following conditions
8b97809a7SJoerg Wunsch.\" are met:
9b97809a7SJoerg Wunsch.\" 1. Redistributions of source code must retain the above copyright
10b97809a7SJoerg Wunsch.\"    notice, this list of conditions and the following disclaimer.
11b97809a7SJoerg Wunsch.\" 2. Redistributions in binary form must reproduce the above copyright
12b97809a7SJoerg Wunsch.\"    notice, this list of conditions and the following disclaimer in the
13b97809a7SJoerg Wunsch.\"    documentation and/or other materials provided with the distribution.
14b97809a7SJoerg Wunsch.\"
15b97809a7SJoerg Wunsch.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16b97809a7SJoerg Wunsch.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17b97809a7SJoerg Wunsch.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18b97809a7SJoerg Wunsch.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19b97809a7SJoerg Wunsch.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20b97809a7SJoerg Wunsch.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21b97809a7SJoerg Wunsch.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22b97809a7SJoerg Wunsch.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23b97809a7SJoerg Wunsch.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24b97809a7SJoerg Wunsch.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25b97809a7SJoerg Wunsch.\"
26b97809a7SJoerg Wunsch.\"
27b97809a7SJoerg Wunsch.Dd May 14, 2001
28b97809a7SJoerg Wunsch.Dt FDREAD 1
29*aa12cea2SUlrich Spörlein.Os
30b97809a7SJoerg Wunsch.Sh NAME
31b97809a7SJoerg Wunsch.Nm fdread
32b97809a7SJoerg Wunsch.Nd read floppy disks
33b97809a7SJoerg Wunsch.Sh SYNOPSIS
34b97809a7SJoerg Wunsch.Nm
35f23229f9SJoerg Wunsch.Op Fl qr
36b97809a7SJoerg Wunsch.Op Fl d Ar device
37b97809a7SJoerg Wunsch.Op Fl f Ar fillbyte
38b97809a7SJoerg Wunsch.Op Fl o Ar file
398a5f4c12SJoerg Wunsch.Nm
408a5f4c12SJoerg Wunsch.Op Fl d Ar device
418a5f4c12SJoerg Wunsch.Fl I Ar numsects
428a5f4c12SJoerg Wunsch.Op Fl t Ar trackno
43b97809a7SJoerg Wunsch.Sh DESCRIPTION
44f23229f9SJoerg WunschThe
45f23229f9SJoerg Wunsch.Nm
4607bfccd7SRuslan Ermilovutility reads floppy disks.
4707bfccd7SRuslan ErmilovEffective read blocking based on the track
48b97809a7SJoerg Wunschsize is performed, and floppy-specific error recovery of otherwise
49b97809a7SJoerg Wunschbad blocks can be enabled.
50b97809a7SJoerg Wunsch.Pp
517f94b8deSPhilippe CharnierThe
52f23229f9SJoerg Wunsch.Nm
537f94b8deSPhilippe Charnierutility
54b97809a7SJoerg Wunschwill always read an entire floppy medium, and write its contents to
5507bfccd7SRuslan Ermilovthe respective output file.
5607bfccd7SRuslan ErmilovUnlike other tools like
57b97809a7SJoerg Wunsch.Xr dd 1 ,
58b97809a7SJoerg Wunsch.Nm
59b97809a7SJoerg Wunschautomatically uses a read block size that is more efficient than
60b97809a7SJoerg Wunschreading single blocks (usually one track of data at a time), but
61b97809a7SJoerg Wunschfalls back to reading single floppy sectors in case of an input/output
62b97809a7SJoerg Wunscherror occurred, in order to obtain as much valid data as possible.
63b97809a7SJoerg WunschWhile
64b97809a7SJoerg Wunsch.Nm
65b97809a7SJoerg Wunschis working, kernel error reporting for floppy errors is turned off, so
66b97809a7SJoerg Wunschthe console and/or syslog are not flooded with kernel error messages.
67f23229f9SJoerg Wunsch.Pp
68f23229f9SJoerg WunschThe
69f23229f9SJoerg Wunsch.Nm
70f23229f9SJoerg Wunschutility accepts the following options:
71f23229f9SJoerg Wunsch.Bl -tag -width indent
72b97809a7SJoerg Wunsch.It Fl q
7307bfccd7SRuslan ErmilovTurn on quiet mode.
7407bfccd7SRuslan ErmilovBy default, the medium parameters of the device
75b97809a7SJoerg Wunschare being written to standard error output, progress will be indicated
76b97809a7SJoerg Wunschby the approximate number of kilobytes read so far, and errors will be
77b97809a7SJoerg Wunschprinted out in detail, including the information about the location of
7807bfccd7SRuslan Ermilovrecovered data in the output.
7907bfccd7SRuslan ErmilovIn quiet mode, none of these messages
80b97809a7SJoerg Wunschwill be generated.
81b97809a7SJoerg Wunsch.It Fl r
8207bfccd7SRuslan ErmilovEnable error recovery.
8307bfccd7SRuslan ErmilovBy default,
84b97809a7SJoerg Wunsch.Nm
85b97809a7SJoerg Wunschstops after the first unrecovered read error, much like
86b97809a7SJoerg Wunsch.Xr dd 1
8707bfccd7SRuslan Ermilovdoes.
8807bfccd7SRuslan ErmilovIn recovery mode, however, one of two recovery actions will be
89b97809a7SJoerg Wunschtaken:
90f23229f9SJoerg Wunsch.Bl -bullet
91b97809a7SJoerg Wunsch.It
92b97809a7SJoerg WunschIf the error was a CRC error in the data field, the
93b97809a7SJoerg Wunschkernel is told to ignore the error, and data are transferred to the
94b97809a7SJoerg Wunschoutput file anyway.
95f23229f9SJoerg Wunsch.Bf -emphasis
96f23229f9SJoerg WunschNote that this will cause the erroneous data
97f23229f9SJoerg Wunschto be included in the output file!
98f23229f9SJoerg Wunsch.Ef
99b97809a7SJoerg WunschStill, this is the best recovery action that can be taken at all.
100b97809a7SJoerg Wunsch.It
1010227791bSRuslan ErmilovAll other errors are really fatal (usually, the FDC did not find the
102b97809a7SJoerg Wunschsector ID fields), thus a dummy block with fill
103b97809a7SJoerg Wunschbytes will be included in the output file.
104b97809a7SJoerg Wunsch.El
105b97809a7SJoerg Wunsch.Pp
106b97809a7SJoerg WunschUnless operating in quiet mode, the action taken and the location of
107b97809a7SJoerg Wunschthe error in the output file will be displayed.
108b97809a7SJoerg Wunsch.It Fl d Ar device
109b97809a7SJoerg WunschSpecify the input floppy device, defaulting to
110b97809a7SJoerg Wunsch.Pa /dev/fd0 .
111b97809a7SJoerg WunschThe parameter
112b97809a7SJoerg Wunsch.Ar device
113b97809a7SJoerg Wunschmust be a valid floppy disk device.
114b97809a7SJoerg Wunsch.It Fl f Ar fillbyte
115b97809a7SJoerg WunschValue of the fill byte used for dummy blocks in the output file in
11607bfccd7SRuslan Ermilovrecovery mode.
11707bfccd7SRuslan ErmilovDefaults to
118b97809a7SJoerg Wunsch.Ql 0xf0 .
119b97809a7SJoerg Wunsch(Mnemonic:
120b97809a7SJoerg Wunsch.Dq foo . )
121b97809a7SJoerg WunschThe value can be specified using the usual C language notation of
122b97809a7SJoerg Wunschthe number base.
123b97809a7SJoerg Wunsch.It Fl o Ar file
124b97809a7SJoerg WunschSpecify the output file to be
125b97809a7SJoerg Wunsch.Ar file .
126b97809a7SJoerg WunschBy default, the data will be written to standard output.
1278a5f4c12SJoerg Wunsch.It Fl I Ar numsects
1288a5f4c12SJoerg WunschRead
1298a5f4c12SJoerg Wunsch.Ar numsects
1308a5f4c12SJoerg Wunschsector ID fields, and write out their contents to standard output.
1318a5f4c12SJoerg WunschEach sector ID field contains recorded values for the cylinder number
1328a5f4c12SJoerg Wunsch.Pq Ql C ,
1338a5f4c12SJoerg Wunschthe head number
1348a5f4c12SJoerg Wunsch.Pq Ql H ,
1358a5f4c12SJoerg Wunschthe record number (sector number starting with 1)
1368a5f4c12SJoerg Wunsch.Pq Ql R ,
1378a5f4c12SJoerg Wunschand the
1388a5f4c12SJoerg Wunsch.Em sector shift value
139dbc58deaSRuslan Ermilov(0 = 128 bytes, 1 = 256 bytes, 2 = 512 bytes, 3 = 1024 bytes)
1408a5f4c12SJoerg Wunsch.Pq Ql N .
1418a5f4c12SJoerg WunschThe
1428a5f4c12SJoerg Wunsch.Fl I
1438a5f4c12SJoerg Wunschoption is mutually exclusive with all other options except
1448a5f4c12SJoerg Wunsch.Fl d Ar device
1458a5f4c12SJoerg Wunschand
1468a5f4c12SJoerg Wunsch.Fl t Ar trackno .
1478a5f4c12SJoerg Wunsch.It Fl t Ar trackno
1488a5f4c12SJoerg WunschSpecify the track number (cylinder number * number of heads + head
1498a5f4c12SJoerg Wunschnumber) to read the sector ID fields from; only allowed together with
1508a5f4c12SJoerg Wunschthe
1518a5f4c12SJoerg Wunsch.Fl I Ar numsects
1528a5f4c12SJoerg Wunschoption.
153b97809a7SJoerg Wunsch.El
154b97809a7SJoerg Wunsch.Sh FILES
155f23229f9SJoerg Wunsch.Bl -tag -width /dev/fd0
156b97809a7SJoerg Wunsch.It Pa /dev/fd0
157b97809a7SJoerg WunschDefault device to read from.
158f23229f9SJoerg Wunsch.El
159a866e170SRuslan Ermilov.Sh EXIT STATUS
1607f94b8deSPhilippe CharnierThe
161f23229f9SJoerg Wunsch.Nm
1627f94b8deSPhilippe Charnierutility sets the exit value according to
163b97809a7SJoerg Wunsch.Xr sysexits 3 .
164b97809a7SJoerg WunschIn recovery mode, the exit value will be set to
165f23229f9SJoerg Wunsch.Dv EX_IOERR
166b97809a7SJoerg Wunschif any error occurred during processing (even in quiet mode).
167a866e170SRuslan Ermilov.Sh DIAGNOSTICS
168b97809a7SJoerg WunschUnless running in quiet mode, upon encountering an error, the status
169b97809a7SJoerg Wunschof the floppy disc controller (FDC) will be printed out, both in
170b97809a7SJoerg Wunschhexadecimal form, followed by a textual description that translates
171b97809a7SJoerg Wunschthose values into a human-readable form for the most common error
172b97809a7SJoerg Wunschcases that can happen in a PC environment.
173b97809a7SJoerg Wunsch.Pp
174b97809a7SJoerg WunschThe FDC error status includes the three FDC status registers
175b97809a7SJoerg Wunsch.Ql ST0 ,
176b97809a7SJoerg Wunsch.Ql ST1 ,
177b97809a7SJoerg Wunschand
178b97809a7SJoerg Wunsch.Ql ST2 ,
179b97809a7SJoerg Wunschas well as the location of the error (physical cylinder, head, and sector
180b97809a7SJoerg Wunschnumber, plus the
181b97809a7SJoerg Wunsch.Dq sector shift value ,
18207bfccd7SRuslan Ermilovrespectively).
18307bfccd7SRuslan ErmilovSee the manual for the NE765 or compatible for details
184b97809a7SJoerg Wunschabout the status register contents.
185b97809a7SJoerg Wunsch.Pp
186b97809a7SJoerg WunschThe FDC's status is then examined to determine whether the error is
18707bfccd7SRuslan Ermilovdeemed to be recoverable.
18807bfccd7SRuslan ErmilovIf error recovery was requested, the
189b97809a7SJoerg Wunschlocation of the bad block in the output file is indicated by its
19007bfccd7SRuslan Ermilov(hexadecimal) bounds.
19107bfccd7SRuslan ErmilovAlso, a summary line indicating the total number
192b97809a7SJoerg Wunschof transfer errors will be printed before exiting.
193b97809a7SJoerg Wunsch.Sh SEE ALSO
194b97809a7SJoerg Wunsch.Xr dd 1 ,
195b97809a7SJoerg Wunsch.Xr fdwrite 1 ,
196f23229f9SJoerg Wunsch.Xr sysexits 3 ,
197f23229f9SJoerg Wunsch.Xr fdc 4 ,
198f23229f9SJoerg Wunsch.Xr fdcontrol 8
199b97809a7SJoerg Wunsch.Sh HISTORY
200f23229f9SJoerg WunschThe
201f23229f9SJoerg Wunsch.Nm
202f23229f9SJoerg Wunschutility was written mainly to provide a means of recovering at least some of
203b97809a7SJoerg Wunschthe data on bad media, and to obviate the need to invoke
204b97809a7SJoerg Wunsch.Xr dd 1
205b97809a7SJoerg Wunschwith too many hard to memorize options that might be useful to handle
206b97809a7SJoerg Wunscha floppy.
207b97809a7SJoerg Wunsch.Pp
208b97809a7SJoerg WunschThe command appeared in
209b97809a7SJoerg Wunsch.Fx 5.0 .
210b97809a7SJoerg Wunsch.Sh AUTHORS
211b97809a7SJoerg WunschProgram and man page by
212f23229f9SJoerg Wunsch.An J\(:org Wunsch .
213b97809a7SJoerg Wunsch.Sh BUGS
214b97809a7SJoerg WunschConcurrent traffic on the second floppy drive located at the same FDC
215b97809a7SJoerg Wunschwill make error recovery attempts pointless, since the FDC status
216b97809a7SJoerg Wunschobtained after a read error occurred cannot be guaranteed to actually
21707bfccd7SRuslan Ermilovbelong to the erroneous transfer.
21807bfccd7SRuslan ErmilovThus using option
219b97809a7SJoerg Wunsch.Fl r
220b97809a7SJoerg Wunschis only reliable if
221b97809a7SJoerg Wunsch.Ar device
222b97809a7SJoerg Wunschis the only active drive on that controller.
223b97809a7SJoerg Wunsch.Pp
224b97809a7SJoerg WunschNo attempt beyond the floppy error retry mechanism of
225b97809a7SJoerg Wunsch.Xr fdc 4
226b97809a7SJoerg Wunschis made in order to see whether bad sectors could still be read
227b97809a7SJoerg Wunschwithout errors by trying multiple times.
228b97809a7SJoerg Wunsch.Pp
229b97809a7SJoerg WunschBits that are (no longer) available on the floppy medium cannot be
230b97809a7SJoerg Wunschguessed by
231f23229f9SJoerg Wunsch.Nm .
232