%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/309157/task/309157/root/usr/share/doc/gddrescue/html/
Upload File :
Create Path :
Current File : //proc/309157/task/309157/root/usr/share/doc/gddrescue/html/Algorithm.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<title>Algorithm (GNU ddrescue Manual)</title>

<meta name="description" content="Algorithm (GNU ddrescue Manual)">
<meta name="keywords" content="Algorithm (GNU ddrescue Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-index.html" rel="index" title="Concept index">
<link href="index.html" rel="up" title="Top">
<link href="Output.html" rel="next" title="Output">
<link href="Important-advice.html" rel="prev" title="Important advice">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<span id="Algorithm"></span><div class="header">
<p>
Next: <a href="Output.html" accesskey="n" rel="next">Output</a>, Previous: <a href="Important-advice.html" accesskey="p" rel="prev">Important advice</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Concept-index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Algorithm-1"></span><h2 class="chapter">4 Algorithm</h2>
<span id="index-algorithm"></span>

<p>GNU ddrescue is not a derivative of dd, nor is related to dd in any way
except in that both can be used for copying data from one device to
another. The key difference is that ddrescue uses a sophisticated
algorithm to copy data from failing drives causing them as little
additional damage as possible.
</p>
<p>Ddrescue manages efficiently the status of the rescue in progress and
tries to rescue the good parts first, scheduling reads inside bad (or
slow) areas for later. This maximizes the amount of data that can be
finally recovered from a failing drive.
</p>
<p>The standard dd utility can be used to save data from a failing drive,
but it reads the data sequentially, which may wear out the drive without
rescuing anything if the errors are at the beginning of the drive.
</p>
<p>Other programs read the data sequentially but switch to small size reads
when they find errors. This is a bad idea because it means spending more
time at error areas, damaging the surface, the heads and the drive
mechanics, instead of getting out of them as fast as possible. This
behavior reduces the chances of rescuing the remaining good data.
</p>
<p>The algorithm of ddrescue is as follows (the user may interrupt the
process at any point, but be aware that a bad drive can block ddrescue
for a long time until the kernel gives up):
</p>
<p>1) Optionally read a mapfile describing the status of a multi-part or
previously interrupted rescue. If no mapfile is specified or is empty or
does not exist, mark all the rescue domain as non-tried.
</p>
<p>2) (First phase; Copying) Copying is done in up to five passes. The
first pass reads the non-tried parts of the input file, marking the
failed blocks as non-trimmed and skipping beyond them. The second pass
delimits the blocks skipped by the first pass. The first two passes also
skip beyond slow areas. The skipped areas are tried later in one or
three additional passes (before trimming). The copying direction is
reversed after each pass until all the rescue domain is tried.
</p>
<p>The third and fourth passes read the blocks skipped due to slow areas
(if any) by the first two passes, in the same direction that each block
was skipped. For each block, passes 2 to 4 skip the rest of the block
after finding the first error in the block. The last pass is a sweeping
pass, with skipping disabled. The purpose of the multiple passes is to
delimit large bad areas fast, recover the most promising areas first,
keep the mapfile small, and produce good starting points for trimming.
</p>
<p>Only non-tried areas are read in large blocks. Trimming, scraping and
retrying are done sector by sector. Each sector is tried at most two
times; the first in this phase as part of a large block read, the second
in one of the phases below as a single sector read.
</p>
<p>3) (Second phase; Trimming) Trimming is done in one pass. For each
non-trimmed block, read forwards one sector at a time from the leading
edge of the block until a bad sector is found. Then read backwards one
sector at a time from the trailing edge of the block until a bad sector
is found. Then mark the bad sectors found (if any) as bad-sector, and
mark the rest of the block as non-scraped without trying to read it. If
any edge is already adjacent to a bad sector, it is considered as
already trimmed and is not trimmed again.
</p>
<p>4) (Third phase; Scraping) Scrape together the data not recovered by the
copying or trimming phases. Scraping is done in one pass. Each
non-scraped block is read forwards, one sector at a time. Any bad
sectors found are marked as bad-sector.
</p>
<p>5) (Fourth phase; Retrying) Optionally try to read again the bad sectors
until the specified number of retry passes is reached. The direction is
reversed after each pass. Every bad sector is tried only once in each
pass. Ddrescue can&rsquo;t know if a bad sector is unrecoverable or if it will
be eventually read after some retries.
</p>
<p>6) Optionally write a mapfile for later use.
</p>
<br>
<p>The mapfile is periodically saved to disc, as well as when ddrescue
finishes or is interrupted. So in case of a crash you can resume the
rescue with little recopying. The default interval between saves varies
from 30 seconds to 5 minutes depending on mapfile size (larger mapfiles
are saved at longer intervals), but may be overriden with
&lsquo;<samp>--mapfile-interval</samp>&rsquo;.
</p>
<p>Also, the same mapfile can be used for multiple commands that copy
different areas of the input file, and for multiple recovery attempts
over different subsets. See this example:
</p>
<p>Rescue the most important part of the disc first.
</p><div class="example">
<pre class="example">ddrescue -i0 -s50MiB /dev/sdc hdimage mapfile
ddrescue -i0 -s1MiB -d -r3 /dev/sdc hdimage mapfile
</pre></div>

<p>Then rescue some key disc areas.
</p><div class="example">
<pre class="example">ddrescue -i30GiB -s10GiB /dev/sdc hdimage mapfile
ddrescue -i230GiB -s5GiB /dev/sdc hdimage mapfile
</pre></div>

<p>Now rescue the rest (does not recopy what is already done).
</p><div class="example">
<pre class="example">ddrescue /dev/sdc hdimage mapfile
ddrescue -d -r3 /dev/sdc hdimage mapfile
</pre></div>


<hr>
<div class="header">
<p>
Next: <a href="Output.html" accesskey="n" rel="next">Output</a>, Previous: <a href="Important-advice.html" accesskey="p" rel="prev">Important advice</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Concept-index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>

Zerion Mini Shell 1.0