2006-05-06 19:52:25 +00:00
|
|
|
.\" Copyright (c) 2006 Ulrich Spoerlein <uspoerlein@gmail.com>
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2013-10-01 18:41:53 +00:00
|
|
|
.Dd October 1, 2013
|
2006-05-06 19:52:25 +00:00
|
|
|
.Dt RECOVERDISK 1
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm recoverdisk
|
|
|
|
.Nd recover data from hard disk or optical media
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2009-03-11 10:37:02 +00:00
|
|
|
.Op Fl b Ar bigsize
|
2011-05-01 20:14:10 +00:00
|
|
|
.Op Fl r Ar readlist
|
|
|
|
.Op Fl s Ar interval
|
|
|
|
.Op Fl w Ar writelist
|
|
|
|
.Ar source
|
|
|
|
.Op Ar destination
|
2006-05-06 19:52:25 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility reads data from the
|
2011-05-01 20:14:10 +00:00
|
|
|
.Ar source
|
2006-05-06 19:52:25 +00:00
|
|
|
file until all blocks could be successfully read.
|
2011-05-01 20:14:10 +00:00
|
|
|
If
|
|
|
|
.Ar destination
|
|
|
|
was specified all data is being written to that file.
|
2006-05-06 19:52:25 +00:00
|
|
|
It starts reading in multiples of the sector size.
|
|
|
|
Whenever a block fails, it is put to the end of the working queue and will be
|
|
|
|
read again, possibly with a smaller read size.
|
|
|
|
.Pp
|
2009-03-11 10:37:02 +00:00
|
|
|
By default it uses block sizes of roughly 1 MB, 32kB, and the native
|
|
|
|
sector size (usually 512 bytes).
|
2006-05-06 19:52:25 +00:00
|
|
|
These figures are adjusted slightly, for devices whose sectorsize is not a
|
|
|
|
power of 2, e.g., audio CDs with a sector size of 2352 bytes.
|
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width indent
|
2009-03-11 10:37:02 +00:00
|
|
|
.It Fl b Ar bigsize
|
|
|
|
The size of reads attempted first.
|
|
|
|
The middle pass is roughly the logarithmic average of the bigsize and
|
|
|
|
the sectorsize.
|
2011-05-01 20:14:10 +00:00
|
|
|
.It Fl r Ar readlist
|
2006-05-06 19:52:25 +00:00
|
|
|
Read the list of blocks and block sizes to read from the specified file.
|
2011-05-01 20:14:10 +00:00
|
|
|
.It Fl s Ar interval
|
|
|
|
How often we should update the writelist file while things go OK.
|
|
|
|
The default is 60 and the unit is "progress messages" so if things
|
2009-03-11 10:37:02 +00:00
|
|
|
go well, this is the same as once per minute.
|
2011-05-01 20:14:10 +00:00
|
|
|
.It Fl w Ar writelist
|
2006-05-06 19:52:25 +00:00
|
|
|
Write the list of remaining blocks to read to the specified file if
|
|
|
|
.Nm
|
2006-09-30 17:21:37 +00:00
|
|
|
is aborted via
|
|
|
|
.Dv SIGINT .
|
2006-05-06 19:52:25 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fl r
|
|
|
|
and
|
|
|
|
.Fl w
|
2006-09-30 17:21:37 +00:00
|
|
|
options can be specified together.
|
2006-05-06 19:52:25 +00:00
|
|
|
Especially, they can point to the same file, which will be updated on abort.
|
|
|
|
.Sh OUTPUT
|
2006-09-30 17:21:37 +00:00
|
|
|
The
|
2006-05-06 19:52:25 +00:00
|
|
|
.Nm
|
2006-09-30 17:21:37 +00:00
|
|
|
utility
|
2006-05-06 19:52:25 +00:00
|
|
|
prints several columns, detailing the progress
|
|
|
|
.Bl -tag -width remaining
|
2006-09-30 17:21:37 +00:00
|
|
|
.It Va start
|
2006-05-06 19:52:25 +00:00
|
|
|
Starting offset of the current block.
|
2006-09-30 17:21:37 +00:00
|
|
|
.It Va size
|
2006-05-06 19:52:25 +00:00
|
|
|
Read size of the current block.
|
2006-09-30 17:21:37 +00:00
|
|
|
.It Va len
|
2006-05-06 19:52:25 +00:00
|
|
|
Length of the current block.
|
2006-09-30 17:21:37 +00:00
|
|
|
.It Va state
|
2006-05-06 19:52:25 +00:00
|
|
|
Is increased for every failed read.
|
2006-09-30 17:21:37 +00:00
|
|
|
.It Va done
|
2006-05-06 19:52:25 +00:00
|
|
|
Number of bytes already read.
|
2006-09-30 17:21:37 +00:00
|
|
|
.It Va remaining
|
2006-05-06 19:52:25 +00:00
|
|
|
Number of bytes remaining.
|
2006-09-30 17:21:37 +00:00
|
|
|
.It Va "% done"
|
2006-05-06 19:52:25 +00:00
|
|
|
Percent complete.
|
|
|
|
.El
|
|
|
|
.Sh EXAMPLES
|
2006-09-30 17:21:37 +00:00
|
|
|
.Bd -literal
|
2013-10-01 18:41:53 +00:00
|
|
|
# recover data from failing hard drive ada3
|
|
|
|
recoverdisk /dev/ada3 /data/disk.img
|
2006-09-30 17:21:37 +00:00
|
|
|
|
2006-05-06 19:52:25 +00:00
|
|
|
# clone a hard disk
|
2013-10-01 18:41:53 +00:00
|
|
|
recoverdisk /dev/ada3 /dev/ada4
|
2006-09-30 17:21:37 +00:00
|
|
|
|
2006-05-06 19:52:25 +00:00
|
|
|
# read an ISO image from a CD-ROM
|
2011-05-01 20:14:10 +00:00
|
|
|
recoverdisk /dev/cd0 /data/cd.iso
|
2006-09-30 17:21:37 +00:00
|
|
|
|
2006-05-06 19:52:25 +00:00
|
|
|
# continue reading from a broken CD and update the existing worklist
|
2011-05-01 20:14:10 +00:00
|
|
|
recoverdisk -r worklist -w worklist /dev/cd0 /data/cd.iso
|
2006-09-30 17:21:37 +00:00
|
|
|
|
2006-05-06 19:52:25 +00:00
|
|
|
# recover a single file from the unreadable media
|
2011-05-01 20:14:10 +00:00
|
|
|
recoverdisk /cdrom/file.avi file.avi
|
2009-03-11 10:37:02 +00:00
|
|
|
|
|
|
|
# If the disk hangs the system on read-errors try:
|
2013-10-01 18:41:53 +00:00
|
|
|
recoverdisk -b 0 /dev/ada3 /somewhere
|
2009-03-11 10:37:02 +00:00
|
|
|
|
2006-09-30 17:21:37 +00:00
|
|
|
.Ed
|
2006-05-06 19:52:25 +00:00
|
|
|
.Sh SEE ALSO
|
2012-01-05 21:36:20 +00:00
|
|
|
.Xr dd 1 ,
|
2013-07-12 09:20:55 +00:00
|
|
|
.Xr ada 4 ,
|
|
|
|
.Xr cam 4 ,
|
|
|
|
.Xr cd 4 ,
|
2012-01-05 21:36:20 +00:00
|
|
|
.Xr da 4
|
2006-05-06 19:52:25 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
2006-09-30 17:21:37 +00:00
|
|
|
utility first appeared in
|
2006-05-06 19:52:25 +00:00
|
|
|
.Fx 7.0 .
|
2006-09-30 17:21:37 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
.An -nosplit
|
|
|
|
The original implementation was done by
|
2014-06-20 09:40:43 +00:00
|
|
|
.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org
|
2006-09-30 17:21:37 +00:00
|
|
|
with minor improvements from
|
2014-06-20 09:40:43 +00:00
|
|
|
.An Ulrich Sp\(:orlein Aq Mt uqs@FreeBSD.org .
|
2006-09-30 17:21:37 +00:00
|
|
|
.Pp
|
|
|
|
This manual page was written by
|
|
|
|
.An Ulrich Sp\(:orlein .
|
2006-05-06 19:52:25 +00:00
|
|
|
.Sh BUGS
|
|
|
|
Reading from media where the sectorsize is not a power of 2 will make all
|
|
|
|
1 MB reads fail.
|
|
|
|
This is due to the DMA reads being split up into blocks of at most 128kB.
|
|
|
|
These reads then fail if the sectorsize is not a divisor of 128kB.
|
|
|
|
When reading a full raw audio CD, this leads to roughly 700 error messages
|
|
|
|
flying by.
|
2011-05-01 20:14:10 +00:00
|
|
|
This is harmless and can be avoided by setting
|
|
|
|
.Fl b
|
|
|
|
to no more than 128kB.
|
2012-01-05 21:36:20 +00:00
|
|
|
.Pp
|
|
|
|
.Nm
|
|
|
|
needs to know about read errors as fast as possible, i.e. retries by lower
|
|
|
|
layers will usually slow down the operation.
|
|
|
|
When using
|
|
|
|
.Xr cam 4
|
|
|
|
attached drives, you may want to set kern.cam.XX.retry_count to zero, e.g.:
|
|
|
|
.Bd -literal
|
|
|
|
# sysctl kern.cam.ada.retry_count=0
|
|
|
|
# sysctl kern.cam.cd.retry_count=0
|
|
|
|
# sysctl kern.cam.da.retry_count=0
|
|
|
|
.Ed
|
2011-05-01 20:14:10 +00:00
|
|
|
.\".Pp
|
|
|
|
.\"When reading from optical media, a bug in the GEOM framework will
|
|
|
|
.\"prevent it from seeing that the media has been removed.
|
|
|
|
.\"The device can still be opened, but all reads will fail.
|
|
|
|
.\"This is usually harmless, but will send
|
|
|
|
.\".Nm
|
|
|
|
.\"into an infinite loop.
|