FreeBSD Manual Pages
RECOVERDISK(1) General Commands Manual RECOVERDISK(1) NAME recoverdisk -- recover data from disk-like devices. SYNOPSIS recoverdisk [-b bigsize] [-i interval] [-r readlist] [-s interval] [-u pattern] [-v] [-w writelist] source [destination] DESCRIPTION The recoverdisk utility reads all data from the source and retries read operations until they succeed. If destination is specified all data read be written there. The internal work-list can be saved and loaded so that recoverdisk ses- sions can be resumed, for instance when a marginal source hard-disk shuts down. The work-list is initialized with a single item which covers the entire source and recoverdisk always chips away at the first item on the work- list. When a read succeeds, that part of the current chunk is eliminated from the work-list. When a read fails, that part of the item is appended to the worklist as a separate item, and will be retried in due order. If destination is specified, the corresponding range is filled with '_UNREAD_'. The first pass attempts to read everything in "big-size" chunks, the second pass reads in "medium-size" chunks and third and subsequent passes read in "small-size" chunks. This three stage process is an at- tempt to optimize the case where only a few bad blocks exist on source. If too many read-errors are encountered, recoverdisk will fall back to smaller sizes sooner. The three sizes default to 128kB (or less if the sector size does not divide 128kB cleanly, for instance audio CD media), and the reported DIOCGSTRIPESIZE and DIOCGSECTORSIZE respectively. The options are as follows: -b bigsize The size of reads attempted in first pass. -m mediumsize The size of reads attempted in second pass. -s smallsize The size of reads attempted in third and subsequent passes. -r work-list-file Read the work-list from a file. -w work-list-file Write the work-list to a file when a read succeed, but at most once every minute. -l log-file Each successful read is logged with timestamp, offset and length. -t totalsize How many bytes should be recovered. The default is what DIOCGMEDIASIZE reports for character and block devices or st_size if source is a regular file. -i pause sleep(3) this long between reads. This reduces the load on the source device and the system in general. -p pause sleep(3) this long whenever a read fails. This makes the source device look less sick to the operating system. -u pattern By default blocks which cannot be read are filled with the pat- tern `_UNREAD_' in the output file. This option can be used to specify a different pattern. If the pattern is the empty string, nothing is written. -v Produce a detailed progress report with ANSI escapes and UTF-8. recoverdisk can be aborted with SIGINT, but with a sick source it may take up to several minutes before the current read operation returns from the kernel. EXAMPLES # check if all sectors can be read on a USB stick: recoverdisk /dev/da0 # recover data from failing hard drive ada3 recoverdisk /dev/ada3 /data/disk.img # clone a hard disk recoverdisk /dev/ada3 /dev/ada4 # read an ISO image from a CD-ROM recoverdisk /dev/cd0 /data/cd.iso # continue reading from a broken CD and update the existing worklist recoverdisk -r worklist -w worklist /dev/cd0 /data/cd.iso # recover a single file from the unreadable media recoverdisk /cdrom/file.avi file.avi PRACTICAL ADVICE In Datamuseum.dk recoverdisk has been used to recover all sorts of data-media for two decades, here are some things we have learned: • Interacting with failing hardware has a tendency to crash machines, so it is always a good idea to use the --w -work-list-file so that it is possible to continue. • When attempting to recover hard to read data from failing hard disks, it pays to pamper the drive as much as possible: • It is generally best to keep the drive in it's usual physical ori- entation, but it can also help to try other orientations. • Insulate the drive from external vibrations. • Keep the drive cool with a fan. • If possible, power the drive from a laboratory power supply. • Do not loose patience: Let recoverdisk run as long as possible. • (S)ATA controllers do not handle failing disks well, if this is a problem, use a USB-(S)ATA adapter instead. • The recoverdisk source code is deliberately written to be easily portable to older versions of FreeBSD and to other operating sys- tems. • If you need to read ST-506, RLL or ESDI drives FreeBSD 3.5.1 is a good compromise. • Sometimes forcing the disk to step between reads helps. Since recoverdisk process the work-list in the order it is read, this can be accomplished by sorting the work-list with something like: % sort +0.5 • By default the CAM layer will retry failing read operations, but that will get stuck on the bad sectors for long time and delay re- covering what actually can be read from a rapidly failing drive. In that situation, set the appropriate kern.cam.*.retry_count sysctl to zero. • For floppies and un-zoned hard disks (ST-506 to early IDE) set -b bigsize to the size of a track. SEE ALSO dd(1), ada(4), cam(4), cd(4), da(4) HISTORY The recoverdisk utility first appeared in FreeBSD 7.0 because Somebody forgot to make a backup copy. AUTHORS The original implementation was done by Poul-Henning Kamp <phk@FreeBSD.org> with minor improvements from Ulrich Sporlein <uqs@FreeBSD.org>. This manual page was originally written by Ulrich Sporlein. BUGS If a failing device causes the machine to crash, there is a risk that a chunk might have been successfully read and removed from the work-list, but not yet flushed to the destination. recoverdisk calls fdatasync(3) on the destination before writing the work-list to a temporary file, and calls it again on the temporary file before renaming it to the specified -w work-file-list filename. But even then things dont always work out. recoverdisk should have an option for reconstructing the work-list from the destination by enumerating the -u pattern filled ranges. FreeBSD 15.0 April 3, 2020 RECOVERDISK(1)
NAME | SYNOPSIS | DESCRIPTION | EXAMPLES | PRACTICAL ADVICE | SEE ALSO | HISTORY | AUTHORS | BUGS
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=recoverdisk&sektion=1&manpath=FreeBSD+15.0-RELEASE+and+Ports>
