[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-ddrescue] Enhancement request for ddrescue's fillmode
From: |
Shahrukh Merchant |
Subject: |
[Bug-ddrescue] Enhancement request for ddrescue's fillmode |
Date: |
Tue, 10 Oct 2017 16:00:25 -0300 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
Enhancement request for ddrescue's fillmode
WHAT:
----
Change the ddrescue output format when using the fillmode-with-location
option, i.e.,
ddrescue --fill-mode=l- fillfile imagefile mapfile
from the multiline-per-sector:
----------------------------------------------------
# position sector status
0xCDDCA20000 0x66EE5100 -
DEADBEATDEADBEAT....
# position sector status
0xCDDCA20200 0x66EE5101 -
DEADBEATDEADBEAT....
...
----------------------------------------------------
to the single-line-per-sector:
----------------------------------------------------
Position 0xCDDCA20000 Sector 0x66EE5100 Status - DEADBEATDEADBEAT....
Position 0xCDDCA20200 Sector 0x66EE5101 Status - DEADBEATDEADBEAT....
...
----------------------------------------------------
The horizontal lines and elipses (...) are not part of the ddrescue
output--I've inserted them for clarity in this message. "DEADBEAT" is
sample fill text--it could be anything.
WHY:
---
While there are various uses for fill mode, the main purpose is to be
able to identify files that had bad sectors by searching (post
processing outside ddrescue) for the repeating text pattern inserted by
ddrescue's fillmode, and furthermore, with the -l option, identifying
which bad sectors they included. The second format I propose allows
simple text search tools (in Windows and/or Unix) to be used to do this
while the first requires unnecessarily convoluted approaches (writing a
Perl/Awk/Python script to do effectively a multi-line search, or using
grep with complex search patterns with regular expressions and embedded
newlines, or opening each file in a text editor and manually checking
the preceding line, etc.).
I had only 10 files so I did it with the text editor approach and it
took hours (some were huge files over 1 GB and took ages to open and
saturated my system RAM) instead of seconds to get this information in a
useable form even though it was already there just one (unfortunate)
newline away!
Furthermore I was doing this post-processing in a Windows environment
where the free and great search tool Agent Ransack (among others) would
easily have handled the second format and trivially given me all the
information I needed with no scripting. Instead it identified the files
for me and printed the repeating pattern line, but I had to go look
inside each file just to see the line above! I.e., the search/grep gave
me as output (for a single file containing multiple bad sectors):
DEADBEATDEADBEAT....
DEADBEATDEADBEAT....
....
when it could just have easily (with my suggested change) have given me
the far more useful:
Position 0xCDDCA20000 Sector 0x66EE5100 Status - DEADBEATDEADBEAT....
Position 0xCDDCA20200 Sector 0x66EE5101 Status - DEADBEATDEADBEAT....
...
COMPLEXITY OF IMPLEMENTATION:
Should be trivial, presumably affecting only a couple of printf
statements to change the fixed text part and remove extraneous newlines
(there should still be one newline at the start of each output line).
Payoff-to-effort ratio is as large as they come!
BACKWARD COMPATIBILITY:
If backward compatibility with previous versions of ddrescue is an issue
(in order not to break someone's workflow that perhaps already
incorporates a script to handle the multi-line format, for example--I
don't know what Gnu's tradition is with this), it gets only slightly
less trivial to define and document a different option for the one-line
format (and default to the multi-line format).
Shahrukh
- [Bug-ddrescue] Enhancement request for ddrescue's fillmode,
Shahrukh Merchant <=