Say I have a file that's downloading (from a source that's hard to re-download from), but accidentally deleted from the filesystem namespace (/tmp/blah), and I'd like to recover this file. Normally I could just cp /proc/$PID/fd/$FD /tmp/blah, but in this case that would only get me a partial snapshot, since the file is still downloading. Furthermore, once the download completes, the downloading process (e.g. Chrome) will close the FD. Any way to recover by inode/create a hard link? Any other solutions? If it makes any difference, I'm mainly concerned with ext4. Thanks in advance.
Tell me more
×
Super User is a question and answer site for
computer enthusiasts and power users. It's 100% free, no registration required.
|
|
||||
|
|
|
Try using tail to copy the file continually:
Of course, you will have to stop the tail process by hand (or some other external means) when the download has finished. |
|||
|
|
The fdlink project, consisting of a Linux kernel module and simple application, purports to create a new link to an open file descriptor. I haven't tried it. |
|||
|
|
|
This will get the job done, though not through by recovering the inode:
Or just manually stop the download in Chrome if you don't want to kill the whole browser. |
|||||||
|