%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/Fill-mode.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>Fill mode (GNU ddrescue Manual)</title>

<meta name="description" content="Fill mode (GNU ddrescue Manual)">
<meta name="keywords" content="Fill mode (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="Generate-mode.html" rel="next" title="Generate mode">
<link href="Direct-disc-access.html" rel="prev" title="Direct disc access">
<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="Fill-mode"></span><div class="header">
<p>
Next: <a href="Generate-mode.html" accesskey="n" rel="next">Generate mode</a>, Previous: <a href="Direct-disc-access.html" accesskey="p" rel="prev">Direct disc access</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="Fill-mode-1"></span><h2 class="chapter">12 Fill mode</h2>
<span id="index-fill-Mode"></span>

<p>When ddrescue is invoked with the &lsquo;<samp>--fill-mode</samp>&rsquo; option it operates
in &quot;fill mode&quot;, which is different from the default &quot;rescue mode&quot;. That
is, if you use the &lsquo;<samp>--fill-mode</samp>&rsquo; option, ddrescue does not rescue
anything. It only fills with data read from <var>infile</var> the blocks of
<var>outfile</var> whose status character from <var>mapfile</var> coincides with
one of the type characters specified as argument to the
&lsquo;<samp>--fill-mode</samp>&rsquo; option.
</p>
<p>If the argument of the &lsquo;<samp>--fill-mode</samp>&rsquo; option contains an &lsquo;<samp>l</samp>&rsquo;,
ddrescue will write location data (position, sector number and status)
into each sector filled. With bad sectors filled in this way, it should
be possible to retry the recovery of important files, as location of the
error is known by looking into the unfinished copy of the file.
</p>
<p>In fill mode <var>infile</var> does not need to be seekable and it may be of
any size. If it is too small, the data will be duplicated as many times
as necessary to fill the input buffer. If it is too big, only the data
needed to fill the input buffer will be read. Then the same data will be
written to every cluster or sector to be filled.
</p>
<p>Note that in fill mode <var>infile</var> is always read from position 0. If
you specify a &lsquo;<samp>--input-position</samp>&rsquo;, it refers to the original
<var>infile</var> from which <var>mapfile</var> was built, and is only used to
calculate the offset between input and output positions.
</p>
<p>Note also that when filling the <var>infile</var> of the original rescue run
you should not set &lsquo;<samp>--output-position</samp>&rsquo;, whereas when filling the
<var>outfile</var> of the original rescue run you should keep the original
offset between &lsquo;<samp>--input-position</samp>&rsquo; and &lsquo;<samp>--output-position</samp>&rsquo;.
</p>
<p>The &lsquo;<samp>--fill-mode</samp>&rsquo; option implies the &lsquo;<samp>--complete-only</samp>&rsquo; option.
</p>
<p>In fill mode <var>mapfile</var> is updated to allow resumability when
interrupted or in case of a crash, but as nothing is being rescued
<var>mapfile</var> is not destroyed. The status line is the only part of
<var>mapfile</var> that is modified.
</p>
<br>
<p>The fill mode has a number of uses. See the following examples:
</p>
<p>Example 1: Mark parts of the rescued copy to allow finding them when
examined in an hex editor. For example, the following command line fills
all blocks marked as &lsquo;<samp>-</samp>&rsquo; (bad-sector) with copies of the string
&lsquo;<samp><span class="nolinebreak">BAD-SECTOR</span>&nbsp;</samp>&rsquo;<!-- /@w -->:
</p>
<div class="example">
<pre class="example">ddrescue --fill-mode=- &lt;(printf &quot;BAD-SECTOR &quot;) outfile mapfile
</pre></div>

<p>Example 2: Wipe only the good sectors, leaving the bad sectors alone.
This way, the drive will still test bad (i.e., with unreadable sectors).
This is the fastest way of wiping a failing drive, and is especially
useful when sending the drive back to the manufacturer for warranty
replacement.
</p>
<div class="example">
<pre class="example">ddrescue --fill-mode=+ --force /dev/zero bad_drive mapfile
</pre></div>

<p>Example 3: Force the drive to remap the bad sectors, making it usable
again. If the drive has only a few bad sectors, and they are not caused
by drive age, you can probably just rewrite those sectors, and the drive
will reallocate them automatically to new &quot;spare&quot; sectors that it keeps
for just this purpose. WARNING! This may not work on your drive.
</p>
<div class="example">
<pre class="example">ddrescue --fill-mode=- -f --synchronous /dev/zero bad_drive mapfile
</pre></div>

<br>
<p>Fill mode can also help you to figure out, independently of the file
system used, what files are partially or entirely in the bad areas of
the disc. Just follow these steps:
</p>
<p>1) Copy the damaged drive with ddrescue until finished. Don&rsquo;t use sparse
writes. This yields a mapfile containing only finished (&lsquo;<samp>+</samp>&rsquo;) and
bad-sector (&lsquo;<samp>-</samp>&rsquo;) blocks.
</p>
<p>2) Fill the bad-sector blocks of the copied drive or image file with a
string not present in any file, for example &quot;DEADBEEF&quot;. Use
&lsquo;<samp>--fill-mode=l-</samp>&rsquo; if you want location data.
</p>
<p>3) Mount the copied drive (or the image file, via loopback device)
read-only.
</p>
<p>4) Grep for the fill string in all the files. Those files containing the
string reside (at least partially) in damaged disc areas. Note that if
all the damaged areas are in unused space, grep will not find the string
in any file, which means that no files are damaged.
</p>
<p>5) Take note of the location data of any important files that you want
to retry.
</p>
<p>6) Unmount the copied drive or image file.
</p>
<p>7) Retry the sectors belonging to the important files until they are
rescued or until it is clear that they can&rsquo;t be rescued.
</p>
<p>8) Optionally fill the bad-sector blocks of the copied drive or image
file with zeros to restore the disc image.
</p>
<p>Example 4: Figure out what files are in the bad areas of the disc.
</p>
<div class="example">
<pre class="example">ddrescue -b2048 /dev/cdrom cdimage mapfile
printf &quot;DEADBEEF&quot; &gt; tmpfile
ddrescue --fill-mode=l- tmpfile cdimage mapfile
rm tmpfile
mount -t iso9660 -o loop,ro cdimage /mnt/cdimage
find /mnt/cdimage -type f -exec grep -l &quot;DEADBEEF&quot; '{}' ';'
  (note that my_thesis.txt has a bad sector at pos 0x12345000)
umount /mnt/cdimage
ddrescue -b2048 -i0x12345000 -s2048 -dr9 /dev/cdrom cdimage mapfile
ddrescue --fill-mode=- /dev/zero cdimage mapfile
mount -t iso9660 -o loop,ro cdimage /mnt/cdimage
cp -a /mnt/cdimage/my_thesis.txt /safe/place/my_thesis.txt
</pre></div>


<hr>
<div class="header">
<p>
Next: <a href="Generate-mode.html" accesskey="n" rel="next">Generate mode</a>, Previous: <a href="Direct-disc-access.html" accesskey="p" rel="prev">Direct disc access</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