]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sbin/recoverdisk/recoverdisk.1
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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 October 1, 2013
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 w Ar writelist
39 .Ar source
40 .Op Ar destination
41 .Sh DESCRIPTION
42 The
43 .Nm
44 utility reads data from the
45 .Ar source
46 file until all blocks could be successfully read.
47 If
48 .Ar destination
49 was specified all data is being written to that file.
50 It starts reading in multiples of the sector size.
51 Whenever a block fails, it is put to the end of the working queue and will be
52 read again, possibly with a smaller read size.
53 .Pp
54 By default it uses block sizes of roughly 1 MB, 32kB, and the native
55 sector size (usually 512 bytes).
56 These figures are adjusted slightly, for devices whose sectorsize is not a
57 power of 2, e.g., audio CDs with a sector size of 2352 bytes.
58 .Pp
59 The options are as follows:
60 .Bl -tag -width indent
61 .It Fl b Ar bigsize
62 The size of reads attempted first.
63 The middle pass is roughly the logarithmic average of the bigsize and
64 the sectorsize.
65 .It Fl r Ar readlist
66 Read the list of blocks and block sizes to read from the specified file.
67 .It Fl s Ar interval
68 How often we should update the writelist file while things go OK.
69 The default is 60 and the unit is "progress messages" so if things
70 go well, this is the same as once per minute.
71 .It Fl w Ar writelist
72 Write the list of remaining blocks to read to the specified file if
73 .Nm
74 is aborted via
75 .Dv SIGINT .
76 .El
77 .Pp
78 The
79 .Fl r
80 and
81 .Fl w
82 options can be specified together.
83 Especially, they can point to the same file, which will be updated on abort.
84 .Sh OUTPUT
85 The
86 .Nm
87 utility
88 prints several columns, detailing the progress
89 .Bl -tag -width remaining
90 .It Va start
91 Starting offset of the current block.
92 .It Va size
93 Read size of the current block.
94 .It Va len
95 Length of the current block.
96 .It Va state
97 Is increased for every failed read.
98 .It Va done
99 Number of bytes already read.
100 .It Va remaining
101 Number of bytes remaining.
102 .It Va "% done"
103 Percent complete.
104 .El
105 .Sh EXAMPLES
106 .Bd -literal
107 # recover data from failing hard drive ada3
108 recoverdisk /dev/ada3 /data/disk.img
109
110 # clone a hard disk
111 recoverdisk /dev/ada3 /dev/ada4
112
113 # read an ISO image from a CD-ROM
114 recoverdisk /dev/cd0 /data/cd.iso
115
116 # continue reading from a broken CD and update the existing worklist
117 recoverdisk -r worklist -w worklist /dev/cd0 /data/cd.iso
118
119 # recover a single file from the unreadable media
120 recoverdisk /cdrom/file.avi file.avi
121
122 # If the disk hangs the system on read-errors try:
123 recoverdisk -b 0 /dev/ada3 /somewhere
124
125 .Ed
126 .Sh SEE ALSO
127 .Xr dd 1 ,
128 .Xr ada 4 ,
129 .Xr cam 4 ,
130 .Xr cd 4 ,
131 .Xr da 4
132 .Sh HISTORY
133 The
134 .Nm
135 utility first appeared in
136 .Fx 7.0 .
137 .Sh AUTHORS
138 .An -nosplit
139 The original implementation was done by
140 .An Poul-Henning Kamp Aq phk@FreeBSD.org
141 with minor improvements from
142 .An Ulrich Sp\(:orlein Aq uqs@FreeBSD.org .
143 .Pp
144 This manual page was written by
145 .An Ulrich Sp\(:orlein .
146 .Sh BUGS
147 Reading from media where the sectorsize is not a power of 2 will make all
148 1 MB reads fail.
149 This is due to the DMA reads being split up into blocks of at most 128kB.
150 These reads then fail if the sectorsize is not a divisor of 128kB.
151 When reading a full raw audio CD, this leads to roughly 700 error messages
152 flying by.
153 This is harmless and can be avoided by setting
154 .Fl b
155 to no more than 128kB.
156 .Pp
157 .Nm
158 needs to know about read errors as fast as possible, i.e. retries by lower
159 layers will usually slow down the operation.
160 When using
161 .Xr cam 4
162 attached drives, you may want to set kern.cam.XX.retry_count to zero, e.g.:
163 .Bd -literal
164 # sysctl kern.cam.ada.retry_count=0
165 # sysctl kern.cam.cd.retry_count=0
166 # sysctl kern.cam.da.retry_count=0
167 .Ed
168 .\".Pp
169 .\"When reading from optical media, a bug in the GEOM framework will
170 .\"prevent it from seeing that the media has been removed.
171 .\"The device can still be opened, but all reads will fail.
172 .\"This is usually harmless, but will send
173 .\".Nm
174 .\"into an infinite loop.