[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-ddrescue] Fill mode does not work if input_position is greater
From: |
Christian Franke |
Subject: |
Re: [Bug-ddrescue] Fill mode does not work if input_position is greater than file size |
Date: |
Sat, 05 Jan 2008 15:31:37 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 |
Hello Antonio,
Of course ddrescue cannot work if input_position is greater than input
file size. Just remember that in fill mode the input file is the file
from which the fill data is read.
In fill mode, the input file reading already wraps around at EOF.
Starting at (input_position % size) would be IMO consistent with this
behaviour.
Try this:
# ddrescue -i 10000000b -s 2000000b -o 0 bad_disk file.img file.log
# ddrescue -F - fill_file file.img file.log
This does not work because file.log records the original offset from
bad_disk, not the resulting offset in file.img.
The fill command has no information about the former difference between
-i and -o. Therefore it will write the output file starting at offset
10000000b, not at 0.
Testcase: Extract 3 blocks from a file, fill second block.
# ddrescue -i 16b -s 3b -o 0 COPYING outfile logfile
logfile:
# Rescue Logfile. Created by GNU ddrescue version 1.7
# current_pos current_status
0x00002200 +
# pos size status
0x00000000 0x00002000 ?
0x00002000 0x00000600 +
0x00002600 0x000062FC ?
Now edit logfile to simulate a bad block:
# Rescue Logfile. Created by GNU ddrescue version 1.7
# current_pos current_status
0x00002200 -
# pos size status
0x00000000 0x00002000 ?
0x00002000 0x00000200 +
0x00002200 0x00000200 -
0x00002400 0x00000200 +
0x00002600 0x000062FC ?
(Hmm...a --simulate-error option would be useful for such testing :-)
# cp outfile outfile.orig
# echo "BAD BLOCK" >fillfile
Now fill bad block as suggested above:
# ddrescue -F - fillfile outfile logfile
Observed result: "BAD BLOCK " appended at the original (infile) position:
# ls -l outfile.orig outfile
-rw-r--r-- 1 ... 9216 Jan 5 14:42 outfile
-rw-r--r-- 1 ... 1536 Jan 5 14:41 outfile.orig
# cmp outfile.orig outfile
cmp: EOF on outfile.orig
# diff -u <(xxd outfile.orig) <(xxd outfile)
--- /dev/fd/63 2006-12-01 01:00:00.000000000 +0100
+++ /dev/fd/62 2006-12-01 01:00:00.000000000 +0100
@@ -94,3 +94,483 @@
00005d0: 7572 206f 7220 7468 6972 6420 7061 7274 ur or third part
00005e0: 6965 7327 206c 6567 616c 2072 6967 6874 ies' legal right
00005f0: 7320 746f 2066 6f72 6269 6420 6369 7263 s to forbid circ
+0000600: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+...
+00021f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+0002200: 4241 4420 424c 4f43 4b0a 4241 4420 424c BAD BLOCK.BAD BL
+0002210: 4f43 4b0a 4241 4420 424c 4f43 4b0a 4241 OCK.BAD BLOCK.BA
+...
+00023e0: 4241 4420 424c 4f43 4b0a 4241 4420 424c BAD BLOCK.BAD BL
+00023f0: 4f43 4b0a 4241 4420 424c 4f43 4b0a 4241 OCK.BAD BLOCK.BA
Expected result: "BAD BLOCK..." should be written to area 0x200-0x3ff of
outfile. Outfile size should not change.
The -i is necessary, because ddrescue records the original physical
offsets in the logfile.
The -i is needed only if you want to read the fill file from a given
position.
It also needed to specify the difference between the (infile) positions
recorded in the logfile and actual positions in outfile.
Hmm...would it make sense the store the input/output_position offset
in the logfile also?
And what is ddrescue supposed to do with them?
E.g. fail if difference between -i and -o is not identical to the first run.
Regards,
Christian