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