NAME
SAFECOPY - A data recovery tool
SYNOPSIS
SAFECOPY [OPTIONS] SOURCE TARGET
DESCRIPTION
A data recovery tool.
Safecopy is a data recovery tool which tries to extract as much data as
possible from a seekable, but problematic (i.e. damaged sectors) source
- like floppy drives, harddisk partitions, CDs, ..., where other tools
like dd would fail doe to I/O errors.
Safecopy tries to get as much data from the source as possible without
device dependent tricks. For example to get an ISO image from a copy
protected or otherwise damaged CD-ROM, cdrdao and bin2iso would
possibly do a better and faster job.
Safecopy comes with preset options (named stages) to ease its use.
These presets can be overridden by individual options.
OPTIONS
Usage: safecopy [options] <source> <target>
-b <size>
Blocksize, also used for skipping offset when searching for the
end of a bad area. Set this to physical sectorsize of your
media.
Default: 1*
If <size> is an integer, then the unit is in bytes.
If <size> is followed by the percentage sign, it express a
percentage of the whole file/device size.
If <size> is followed by a star sign, it means a number of times
the block size reported by the operating system.
-f <size>
Size when skipping over badblocks. Higher values put less
strain on dammaged hardware, but on the other hand, you might
miss good areas in between two bad ones.
Default value is 16*.
If <size> is an integer, then the unit is in bytes.
If <size> is followed by the percentage sign, it express a
percentage of the whole file/device size.
If <size> is followed by a star sign, it means a number of times
the block size. See option -b.
-r <size>
Resolution when searching for the exact beginning or end of a
bad area Bigger values increase performace at potential cost of
valid data close to damaged areas.
Default: 1*
If <size> is an integer, then the unit is in bytes.
If <size> is followed by the percentage sign, it express a
percentage of the whole file/device size.
If <size> is followed by a star sign, it means a number of times
the block size. See option -b.
-R <number>
Number of read attempts on the first bad block of a damaged area
with minimum resolution. More retries can sometimes recover a
weak sector, but at the cost of additional strain.
Default: 3
-Z <number>
On each error, force seek the read head from start to end of the
source device as often as specified. That takes times, create
additional strain and might not be supported by all devices or
drivers.
Default: 1
-L <mode>
Use low level device calls as specified by the mode number.
Where mode number can be:
0: Do not use low level device calls.
1: Attempt low level device calls for error recovery only.
2: Always use low level device calls if available.
Default: 1
--sync
Use synchronized read calls (disable driver buffering).
Safecopy will use O_DIRECT if supported by the operating system
and O_SYNC otherwise.
Default: Asynchronous read buffering.
-s <blocks>
Start position where to start reading. Will correspond to
position 0 in the destination file.
Default: block 0
-l <blocks>
Length of data to be read.
Default: size of input file.
-I <badblockfile>
Incremental mode. Assume the target file already exists and has
holes specified in the badblockfile.
It will attempt to retrieve more data from the listed blocks or
from beyond the file size of the target file only.
WARNING: Without this option, the destination file will be
emptied prior to writing.
Use -I /dev/null if you want to continue a previous run of
safecopy without a badblock list file.
Default: None
-i <bytes>
Blocksize to interpret the badblockfile given with -I.
Default: Blocksize as specified by -b.
-X <badblockfile>
Exclusion mode. If used together with -I, excluded blocks
override included ones. Safecopy will not read or write any data
from areas covered by excluded blocks.
Default: None
-x <bytes>
Blocksize to interpret the badblockfile given with -X.
Default: blocksize as specified by -b
-o <badblockfile>
Write a badblocks/e2fsck compatible bad block file.
Default: None
-S <seekscript>
Use an external script foir seeking in input file. This might be
useful for tape devices or similar.
Seekscript must be an executable that takes the number of blocks
to be skipped as argv1 (1-64) the blocksize in bytes as argv2
and the current position as argv3.
Return values needs to be the number of blocks successfully
skipped, or 0 to indicate seek failure. The external seekscript
will only be used if lseek() fails and we need to skip over
data.
Default: None
-M <string>
Mark unrecovered data with this string instead of skipping it.
This helps in later on rescued file system images.
The default behavior is to zero the unreadable data on creation
of the output files, and leaving the data as it is on any later
run.
WARNING: when used in combination with incremental mode (-I),
this may overwrite data in any block specified in the
badblockfile. Blocks not in the badblockfile, or covered by
those specified in the -X file are safe from being overwritten.
Default: None
--debug <level>
Enable debug output. Level is a bit field, add values together
for more informations as follow:
1 program flow
2 IO control
4 badblock marking
8 seeking
16 incremental mode
32 exclude mode
Use 255 for all debug output.
Default: 0
-T <timingfile>
Write sector read timing information into this file for later
analysis.
Default: None
-h | --help
Show a maybe more detailed help.
PRESETS OPTIONS
--stage1
Preset to rescue most of the data fast, using no retries and
avoiding bad areas.
Presets: -f 10% -r 10% -R 1 -Z 0 -L 2 -M BaDbloCk -o
stage1.badblocks
--stage2
Preset to rescue more data, using no retries but searching for
exact ends of bad areas.
Presets: -f 128* -r 1* -R 1 -Z 0 -L 2 -I stage1.badblocks -o
stage2.badblocks
--stage3
Preset to rescue everything that can be rescued using maximum
retries, head realignment tricks and low level access.
Presets: -f 1* -r 1* -R 4 -Z 1 -L 2 -I stage2.badblocks -o
stage3.badblocks
DESCRIPTION OF OUTPUT
. : Between 1 and 1024 blocks successfully read.
_ : Read was incomplete. (possibly end of file) blocksize is reduced
to read the rest.
> : Read failed, reducing blocksize to read partial data.
[xx](+yy) :
current block and number of blocks (or bytes) continuously read
successfully up to this point.
X : Read failed on block with minimum blocksize and is skipped.
Unrecoverable error, destination file is padded with zeros. Data
is now skipped until end of the unreadable area is reached.
< : Successfull read- test after the end of a bad area causes
backtracking to search for the first readable data.
[xx](+yy) :
Current block and number of blocks (or bytes) of recent
continuous unreadable data.
AUTHOR
safecopy was written by Corvus Corax (corvuscorax@cybertrench.com)
This manual page was originally written by Juan Angulo Moreno
<juan@apuntale.com> for the Debian project (but may be used by others).
It was filled out by Christophe Monniez <christophe.monniez@fccu.be> .
August 2009