]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/fdread/fdread.1
This commit was generated by cvs2svn to compensate for changes in r96536,
[FreeBSD/FreeBSD.git] / usr.sbin / fdread / fdread.1
1 .\"
2 .\" Copyright (c) 2001 Joerg Wunsch
3 .\"
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD$
27 .\"
28 .\"
29 .Dd May 14, 2001
30 .Os
31 .Dt FDREAD 1
32 .Sh NAME
33 .Nm fdread
34 .Nd read floppy disks
35 .Sh SYNOPSIS
36 .Nm
37 .Op Fl qr
38 .Op Fl d Ar device
39 .Op Fl f Ar fillbyte
40 .Op Fl o Ar file
41 .Nm
42 .Op Fl d Ar device
43 .Fl I Ar numsects
44 .Op Fl t Ar trackno
45 .Sh DESCRIPTION
46 The
47 .Nm
48 utility reads floppy disks.  Effective read blocking based on the track
49 size is performed, and floppy-specific error recovery of otherwise
50 bad blocks can be enabled.
51 .Pp
52 The
53 .Nm
54 utility
55 will always read an entire floppy medium, and write its contents to
56 the respective output file.  Unlike other tools like
57 .Xr dd 1 ,
58 .Nm
59 automatically uses a read block size that is more efficient than
60 reading single blocks (usually one track of data at a time), but
61 falls back to reading single floppy sectors in case of an input/output
62 error occurred, in order to obtain as much valid data as possible.
63 While
64 .Nm
65 is working, kernel error reporting for floppy errors is turned off, so
66 the console and/or syslog are not flooded with kernel error messages.
67 .Pp
68 The
69 .Nm
70 utility accepts the following options:
71 .Bl -tag -width indent
72 .It Fl q
73 Turn on quiet mode.  By default, the medium parameters of the device
74 are being written to standard error output, progress will be indicated
75 by the approximate number of kilobytes read so far, and errors will be
76 printed out in detail, including the information about the location of
77 recovered data in the output.  In quiet mode, none of these messages
78 will be generated.
79 .It Fl r
80 Enable error recovery.  By default,
81 .Nm
82 stops after the first unrecovered read error, much like
83 .Xr dd 1
84 does.  In recovery mode, however, one of two recovery actions will be
85 taken:
86 .Bl -bullet
87 .It
88 If the error was a CRC error in the data field, the
89 kernel is told to ignore the error, and data are transferred to the
90 output file anyway.
91 .Bf -emphasis
92 Note that this will cause the erroneous data
93 to be included in the output file!
94 .Ef
95 Still, this is the best recovery action that can be taken at all.
96 .It
97 All other errors are really fatal (usually, the FDC didn't find the
98 sector ID fields), thus a dummy block with fill
99 bytes will be included in the output file.
100 .El
101 .Pp
102 Unless operating in quiet mode, the action taken and the location of
103 the error in the output file will be displayed.
104 .It Fl d Ar device
105 Specify the input floppy device, defaulting to
106 .Pa /dev/fd0 .
107 The parameter
108 .Ar device
109 must be a valid floppy disk device.
110 .It Fl f Ar fillbyte
111 Value of the fill byte used for dummy blocks in the output file in
112 recovery mode.  Defaults to
113 .Ql 0xf0 .
114 (Mnemonic:
115 .Dq foo . )
116 The value can be specified using the usual C language notation of
117 the number base.
118 .It Fl o Ar file
119 Specify the output file to be
120 .Ar file .
121 By default, the data will be written to standard output.
122 .It Fl I Ar numsects
123 Read
124 .Ar numsects
125 sector ID fields, and write out their contents to standard output.
126 Each sector ID field contains recorded values for the cylinder number
127 .Pq Ql C ,
128 the head number
129 .Pq Ql H ,
130 the record number (sector number starting with 1)
131 .Pq Ql R ,
132 and the
133 .Em sector shift value
134 (0 = 128 bytes, 1 = 256 bytes, 2 = 512 bytes, 3 = 1024 bytes)
135 .Pq Ql N .
136 The
137 .Fl I
138 option is mutually exclusive with all other options except
139 .Fl d Ar device
140 and
141 .Fl t Ar trackno .
142 .It Fl t Ar trackno
143 Specify the track number (cylinder number * number of heads + head
144 number) to read the sector ID fields from; only allowed together with
145 the
146 .Fl I Ar numsects
147 option.
148 .El
149 .Sh FILES
150 .Bl -tag -width /dev/fd0
151 .It Pa /dev/fd0
152 Default device to read from.
153 .El
154 .Sh DIAGNOSTICS
155 The
156 .Nm
157 utility sets the exit value according to
158 .Xr sysexits 3 .
159 In recovery mode, the exit value will be set to
160 .Dv EX_IOERR
161 if any error occurred during processing (even in quiet mode).
162 .Pp
163 Unless running in quiet mode, upon encountering an error, the status
164 of the floppy disc controller (FDC) will be printed out, both in
165 hexadecimal form, followed by a textual description that translates
166 those values into a human-readable form for the most common error
167 cases that can happen in a PC environment.
168 .Pp
169 The FDC error status includes the three FDC status registers
170 .Ql ST0 ,
171 .Ql ST1 ,
172 and
173 .Ql ST2 ,
174 as well as the location of the error (physical cylinder, head, and sector
175 number, plus the
176 .Dq sector shift value ,
177 respectively).  See the manual for the NE765 or compatible for details
178 about the status register contents.
179 .Pp
180 The FDC's status is then examined to determine whether the error is
181 deemed to be recoverable.  If error recovery was requested, the
182 location of the bad block in the output file is indicated by its
183 (hexadecimal) bounds.  Also, a summary line indicating the total number
184 of transfer errors will be printed before exiting.
185 .Sh SEE ALSO
186 .Xr dd 1 ,
187 .Xr fdwrite 1 ,
188 .Xr sysexits 3 ,
189 .Xr fdc 4 ,
190 .Xr fdcontrol 8
191 .Sh HISTORY
192 The
193 .Nm
194 utility was written mainly to provide a means of recovering at least some of
195 the data on bad media, and to obviate the need to invoke
196 .Xr dd 1
197 with too many hard to memorize options that might be useful to handle
198 a floppy.
199 .Pp
200 The command appeared in
201 .Fx 5.0 .
202 .Sh AUTHORS
203 Program and man page by
204 .An J\(:org Wunsch .
205 .Sh BUGS
206 Concurrent traffic on the second floppy drive located at the same FDC
207 will make error recovery attempts pointless, since the FDC status
208 obtained after a read error occurred cannot be guaranteed to actually
209 belong to the erroneous transfer.  Thus using option
210 .Fl r
211 is only reliable if
212 .Ar device
213 is the only active drive on that controller.
214 .Pp
215 No attempt beyond the floppy error retry mechanism of
216 .Xr fdc 4
217 is made in order to see whether bad sectors could still be read
218 without errors by trying multiple times.
219 .Pp
220 Bits that are (no longer) available on the floppy medium cannot be
221 guessed by
222 .Nm .