]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/recoverdisk/recoverdisk.1
login(1): when exporting variables check the result of setenv(3)
[FreeBSD/FreeBSD.git] / sbin / recoverdisk / recoverdisk.1
1 .\" Copyright (c) 2006 Ulrich Spoerlein <uspoerlein@gmail.com>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd April 3, 2020
28 .Dt RECOVERDISK 1
29 .Os
30 .Sh NAME
31 .Nm recoverdisk
32 .Nd recover data from hard disk or optical media
33 .Sh SYNOPSIS
34 .Nm
35 .Op Fl b Ar bigsize
36 .Op Fl r Ar readlist
37 .Op Fl s Ar interval
38 .Op Fl u Ar pattern
39 .Op Fl v
40 .Op Fl w Ar writelist
41 .Ar source
42 .Op Ar destination
43 .Sh DESCRIPTION
44 The
45 .Nm
46 utility reads data from the
47 .Ar source
48 file until all blocks could be successfully read.
49 If
50 .Ar destination
51 was specified all data is being written to that file.
52 It starts reading in multiples of the sector size.
53 Whenever a block fails, it is put to the end of the working queue and will be
54 read again, possibly with a smaller read size.
55 .Pp
56 By default it uses block sizes of roughly 1 MB, 32kB, and the native
57 sector size (usually 512 bytes).
58 These figures are adjusted slightly, for devices whose sectorsize is not a
59 power of 2, e.g., audio CDs with a sector size of 2352 bytes.
60 .Pp
61 The options are as follows:
62 .Bl -tag -width indent
63 .It Fl b Ar bigsize
64 The size of reads attempted first.
65 The middle pass is roughly the logarithmic average of the bigsize and
66 the sectorsize.
67 .It Fl r Ar readlist
68 Read the list of blocks and block sizes to read from the specified file.
69 .It Fl s Ar interval
70 How often we should update the writelist file while things go OK.
71 The default is 60 and the unit is "progress messages" so if things
72 go well, this is the same as once per minute.
73 .It Fl u Ar pattern
74 By default blocks which encounter read errors will be filled with
75 the pattern
76 .Ql _UNREAD_
77 in the output file.
78 This option can be
79 used to specify another pattern.
80 Nothing gets written if the string is empty.
81 .It Fl v
82 Enables nicer status report using ANSI escapes and UTF-8.
83 .It Fl w Ar writelist
84 Write the list of remaining blocks to read to the specified file if
85 .Nm
86 is aborted via
87 .Dv SIGINT .
88 .El
89 .Pp
90 The
91 .Fl r
92 and
93 .Fl w
94 options can be specified together.
95 Especially, they can point to the same file, which will be updated on abort.
96 .Sh OUTPUT
97 The
98 .Nm
99 utility
100 prints several columns, detailing the progress
101 .Bl -tag -width remaining
102 .It Va start
103 Starting offset of the current block.
104 .It Va size
105 Read size of the current block.
106 .It Va len
107 Length of the current block.
108 .It Va state
109 Is increased for every failed read.
110 .It Va done
111 Number of bytes already read.
112 .It Va remaining
113 Number of bytes remaining.
114 .It Va "% done"
115 Percent complete.
116 .El
117 .Sh EXAMPLES
118 .Bd -literal
119 # recover data from failing hard drive ada3
120 recoverdisk /dev/ada3 /data/disk.img
121
122 # clone a hard disk
123 recoverdisk /dev/ada3 /dev/ada4
124
125 # read an ISO image from a CD-ROM
126 recoverdisk /dev/cd0 /data/cd.iso
127
128 # continue reading from a broken CD and update the existing worklist
129 recoverdisk -r worklist -w worklist /dev/cd0 /data/cd.iso
130
131 # recover a single file from the unreadable media
132 recoverdisk /cdrom/file.avi file.avi
133
134 # If the disk hangs the system on read-errors try:
135 recoverdisk -b 0 /dev/ada3 /somewhere
136
137 .Ed
138 .Sh SEE ALSO
139 .Xr dd 1 ,
140 .Xr ada 4 ,
141 .Xr cam 4 ,
142 .Xr cd 4 ,
143 .Xr da 4
144 .Sh HISTORY
145 The
146 .Nm
147 utility first appeared in
148 .Fx 7.0 .
149 .Sh AUTHORS
150 .An -nosplit
151 The original implementation was done by
152 .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org
153 with minor improvements from
154 .An Ulrich Sp\(:orlein Aq Mt uqs@FreeBSD.org .
155 .Pp
156 This manual page was written by
157 .An Ulrich Sp\(:orlein .
158 .Sh BUGS
159 Reading from media where the sectorsize is not a power of 2 will make all
160 1 MB reads fail.
161 This is due to the DMA reads being split up into blocks of at most 128kB.
162 These reads then fail if the sectorsize is not a divisor of 128kB.
163 When reading a full raw audio CD, this leads to roughly 700 error messages
164 flying by.
165 This is harmless and can be avoided by setting
166 .Fl b
167 to no more than 128kB.
168 .Pp
169 .Nm
170 needs to know about read errors as fast as possible, i.e., retries by lower
171 layers will usually slow down the operation.
172 When using
173 .Xr cam 4
174 attached drives, you may want to set kern.cam.XX.retry_count to zero, e.g.:
175 .Bd -literal
176 # sysctl kern.cam.ada.retry_count=0
177 # sysctl kern.cam.cd.retry_count=0
178 # sysctl kern.cam.da.retry_count=0
179 .Ed
180 .\".Pp
181 .\"When reading from optical media, a bug in the GEOM framework will
182 .\"prevent it from seeing that the media has been removed.
183 .\"The device can still be opened, but all reads will fail.
184 .\"This is usually harmless, but will send
185 .\".Nm
186 .\"into an infinite loop.