[Top][All Lists]

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

Re: [Bug-ddrescue] Feature request: "Preview" of recently read data

From: Iphone Recovery Online Info
Subject: Re: [Bug-ddrescue] Feature request: "Preview" of recently read data
Date: Wed, 13 Aug 2014 22:57:31 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Hi Felix,

the only external tool that popped in my mind when reading your questions is strace. It outputs all system calls made by the application in question, which includes data reads and writes.

As the simplest example, you may simply say:
strace ddrescue /dev/sda /dev/null
This will spit out things like:

lseek(3, 9437696, SEEK_SET)             = 9437696
read(3, "$\201\0\0D\1\0\0c\327\273O\236\366\247K\n\367\"I\0\0\0\0\0\0\1\0\10\0\0\0\0"..., 65536) = 65536
lseek(4, 9437696, SEEK_SET)             = 0
write(4, "$\201\0\0D\1\0\0c\327\273O\236\366\247K\n\367\"I\0\0\0\0\0\0\1\0\10\0\0\0\0"..., 65536) = 65536
lseek(3, 9503232, SEEK_SET)             = 9503232
read(3, "\0\0\20\0\1\0\20\0\2\0\20\0\301\37n\f\207\3\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536) = 65536
lseek(4, 9503232, SEEK_SET)             = 0
write(4, "\0\0\20\0\1\0\20\0\2\0\20\0\301\37n\f\207\3\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 65536) = 65536

Not too nice, but you can basically see some bytes from each read and write.
You can make it nicer by grepping for reads, for example:
strace -o "|grep read" ddrescue /dev/sda /dev/null

read(3, "\355\201\0\0\250O\3\0$\320IN\260\277\\L\\s#I\0\0\0\0\0\0\1\0\260\1\0\0\0"..., 65536) = 65536 read(3, "\355\201\0\0\20C\7\0T\316\353SV\277\\L\343C\6I\0\0\0\0\0\0\1\0\260\3\0\0\0"..., 65536) = 65536 read(3, "\377\241\0\0\17\0\0\0\264\316\353S6\362\247K6\362\247K\0\0\0\0\0\0\1\0\0\0\0\0\0"..., 65536) = 65536 read(3, "\244\201\0\0\326#\0\0Q.\311H\357\367\247KQ.\311H\0\0\0\0\0\0\1\0\30\0\0\0\0"..., 65536) = 65536

To write strings in a hexadecimal(-like) format, also add -x to strace:
strace -o "|grep read" -x ddrescue /dev/sda /dev/null

read(3, "\xed\x81\x00\x00\x28\x3b\x00\x00\x44\xd9\x6f\x53\x72\xf3\xa7\x4b\x5f\xf9\xd8\x48\x00\x00\x00\x00\x00\x00\x01\x00\x20\x00\x00\x00\x00"..., 65536) = 65536 read(3, "\xff\xa1\x00\x00\x11\x00\x00\x00\x53\xd4\xdd\x4b\x93\xf6\xa7\x4b\x93\xf6\xa7\x4b\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00"..., 65536) = 65536 read(3, "\xed\x81\x00\x00\x10\x43\x07\x00\xba\xce\xeb\x53\x56\xbf\x5c\x4c\xe3\x43\x06\x49\x00\x00\x00\x00\x00\x00\x01\x00\xb0\x03\x00\x00\x00"..., 65536) = 65536 read(3, "\xff\xa1\x00\x00\x0f\x00\x00\x00\xd3\xce\xeb\x53\x37\xf2\xa7\x4b\x37\xf2\xa7\x4b\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00"..., 65536) = 65536

Hope this helps you in some way, until the real feature is implemented.

Best regards,

Dear Antonio,

the somewhat erratic behavior of a filing drive I have on my desk right now gave me the idea to suggest the following feature to be added to ddrescue:

The screen output could be extended by an area displaying a preview of the data most recently read.

This way users could tell rather easily if the currently read area of the drive is filled or empty, if e.g. the drive is returning garbage data (maybe some USB bridge has decided to return only zeroes on all requests).

If it is not too much effort it could be displayed "hex editor" style and the number of preview-lines could be made configurable? Assuming that there is some kind of input buffer in the current implementation just the last few n*16 bytes from it could be included in the output.

E.g. my terminal at the office is something around 300x120 characters in fullscreen so I could get a full sector "previewed".

If someone on this list has an idea how to achieve this by using some external tool (e.g. something like less with follow-mode but for binary data..) I would be happy to hear about it. Since ddrescue does also perform "random-access" writes the image-file I would not know of any easy way to follow the writes to the file with an external program..

Kind Regards

Mockup output (additions are blue):

# ddrescue --data-preview=3 --input-position=315G /dev/sdb sdb.img sdb.log

GNU ddrescue 1.18.1
Press Ctrl-C to interrupt
Initial status (read from logfile)
(sizes below are limited to the domain 315000 MB to 500107 MB)
rescued:     7274 kB,  errsize:       0 B,  errors:       0

Most read data:
16E33A 05 00 50 89 05 00 51 89 05 00 52 89 05 00 53 89 ..P...Q...R...S. 16E34A 05 00 54 89 05 00 55 89 05 00 56 89 05 00 57 89 ..T...U...V...W. 16E35A 05 00 58 89 05 00 59 89 05 00 5a 89 05 00 5b 89 ..X...Y...Z...[.

Current status
rescued:    49217 kB,  errsize:       0 B,  current rate:    21845 B/s
   ipos:   327911 MB,   errors:       0,    average rate:    21788 B/s
   opos:   327911 MB, run time:   32.08 m,  successful read: 0 s ago
Copying non-tried blocks... Pass 1 (forwards)

Bug-ddrescue mailing list

reply via email to

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