Lazza / RecuperaBit

A tool for forensic file system reconstruction.
GNU General Public License v3.0
539 stars 75 forks source link

Print elapsed time and estimated time to completion #46

Open AlexDaniel opened 5 years ago

AlexDaniel commented 5 years ago

When trying to recover large drives, it helps to know how much time you need to wait.

For example, photorec displays this:

Elapsed time 0h00m04s – Estimated time to completion 0h22m54

P.S. Thank you for this tool, looks promising! Although I'm still waiting for it to scan the whole drive…

Edit: It worked! I recovered the files when both testdisk and photorec didn't help at all. Amazing.

Lazza commented 5 years ago

This is actually a very useful suggestion, thank you.

thinrope commented 3 years ago

The dirty hack for a progress bar is using pv to attach to the running process :-D Assuming 17201 is the PID (e.g. use ps aux|fgrep main.py to find it), we need to attach to fd/3:

$ pv -petrabd 17201:3
 325GiB 0:00:25 [ 298MiB/s] [ 306MiB/s] [====>                              ]  5% ETA 4:53:12 

Of course that is just the first pass... May be you can close fd/3 and open fd/4 for next pass and so on. Actually, since pv can monitor several at the same time, opening both fd/3 and fd/4 to the file and using fd/3 for first pass, fd/4 for 2nd and so on (if you read the whole disk once again).

Lazza commented 3 years ago

@thinrope thank you for your suggestion. The plan for the future is to implement a progress bar with tqdm or a similar library.

ilos-vigil commented 3 years ago

For dirty hack mentioned above, if you use sudo to run the script, make sure you choose PID without sudo prefix

root       63157  0.0  0.0  10844  5344 pts/3    S+   14:30   0:00 sudo pypy3 main.py
root       63158 48.5  0.5 108388 96276 pts/3    D+   14:30   0:04 pypy3 main.py
pv -petrabd 63158:3

Otherwise, you'll see this message

pv: pid 63157: fd 3: pipe:[779070]: not a regular file or block device
crotron commented 3 years ago

Although it doesn't produce a progress bar, I found that adding tqdm to feed_all's main loop is still quite helpful. If the code cannot find anything for a while, it at least gives some feedback to the user that the program isn't frozen (side note: I'm currently running it on a clone of a bad drive and I hope that this isn't a bad sign...). Also, it gives you an estimate of the number of iterations/second, which can still be useful if you know how many sectors are on the hard drive.

Lazza commented 3 years ago

I can confirm. I am experimenting with tqdm but unfortunately I don't have a lot of free time in this period.