bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-ddrescue] Perl script to modify ddrescue log files


From: Antonio Diaz Diaz
Subject: Re: [Bug-ddrescue] Perl script to modify ddrescue log files
Date: Thu, 20 Oct 2011 17:38:53 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905

Burkart Lingner wrote:
I can't think of a case where I would use that, but it's nice to have such a feature as long as it's easy to also set <new_types> only, e.g. by leaving <old_types> blank. Do you have a scenario in mind where one would change only specific block types into a new type?

Yes. "Inverting" a logfile could be achieved with the following command:

  ddrescuelog --change-types=+-,-+ logfile > new_logfile

But as you say, I want a solution suited for both simple and obscure cases. Here is the current description of --change-types in the manual:

`-a OLD_TYPES,NEW_TYPES'
`--change-types=OLD_TYPES,NEW_TYPES'
     Change the status of every block in the given domain from one type
     in OLD_TYPES to the corresponding type in NEW_TYPES, much like the
     `tr' command does, and write the resulting logfile to standard
     output. OLD_TYPES and NEW_TYPES are strings of block status
     characters as defined in the chapter Logfile Structure (*note
     Logfile Structure::). Blocks whose status is not in OLD_TYPES are
     left unchanged. If NEW_TYPES is shorter than OLD_TYPES the last
     type of NEW_TYPES is repeated as many times as necessary.

Would you change anything in it?


If I understand <new_types> correctly, "--change-types=/-+,\?/-" for instance would change non-split blocks (/) into non-tried ones (?), bad sectors (-) into non-split blocks (/) and finished blocks (+) into bad sectors (-). That would be weird.

Yes, that would be weird. But perhaps other type combinations are useful. :-)


I like the idea of changing several block types at the same time, but then I would expect them all to change into the same new type.

That is exactly what --change-types does when <new_types> is shorter than <old_types>. See description above.


Altogether while I can't come up with any scenario where one would do that, your solution is suited for both simple and obscure cases. So the worst that could happen is that this advanced feature might never get used.

This is the only type-changing feature of ddrescuelog, so I guess it will be used by anybody needing to change types. :-)


First, block size for ddrescue is 512 byte by default whereas it's 4096 byte for ddrescuelog.

You are right that both block sizes refer to different concepts of "blocks" (device blocks vs filesystem blocks). AFAIK there is no value which is a good default for them both. Hence the two different values.


Second, both man pages mention that "numbers may be followed by a multiplier". I think it would be nice to add something like "Numbers without multiplier are interpreted as bytes." On top of that you may wanna add "See below for multiplier specification" to the parameters "-i", "-o", etc. Oh, finally one more thing: some options have a <bytes> parameter and some have a <pos> parameter according to the man pages. But aren't they really all of the same type that can be multiplied by "k", "Ki", etc.? If so, shouldn't they all be called the same?

Man pages are generated with the "help2man" program, so option descriptions are necessarily short. Also, not all numbers without multiplier are interpreted as bytes. You may very well write "--max-retries=1k", meaning 1000 retries, or even "--cluster-size=1Ki", meaning 1024 sectors.

But you are right that positions are interpreted as bytes, so I'll change their name to <bytes> to made this clearer.


Thanks for your continued effort to improve ddrescue and ddrescuelog. They're both great tools.

You are welcome.


Best regards,
Antonio.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]