I accidentally lost a pdf file during the following process
I was running a pdf software application PDFXCView in Wine in Ubuntu 18.04, to open a pdf file in a ext4 filesystem.
mvthe pdf file somewhere else.
- Then I edited the pdf file already opened in PDFXCView. When I tried to save the edited file, I had to choose "save as..." to locate the current path of the file and attempted to overwrite it. But PDFXCView failed to overwrite the file, furthermore made it disappear and then aborted .
Here are some attempts.
If it can be helpful, I remember the pathname of the lost pdf file.
I couldn't backup the partition of the filesystem by
dd, since I don't have an additional hard drive with big enough capacity for the partition.
debugfsaccording to https://unix.stackexchange.com/a/80285,
$ sudo debugfs -w /dev/sda4 debugfs: lsdel Inode Owner Mode Size Blocks Time deleted 22549259 1000 100600 141 1/ 1 Sat Apr 2 09:14:06 2016 1 deleted inodes found. debugfs: logdump -i 22549259 22549259: File not found by ext2_lookup
The file was just lost instead of being deleted in 2016, so I am not sure if it found the correct inode.
I saw in https://unix.stackexchange.com/a/98700/ that says using
grep -a -C 500 'known pattern' /dev/sda | tee /tmp/recover
to recover a text file which contains a known pattern.
A while ago, I created the lost pdf file by concatenating several smaller pdf files using
pdftkand I still have those smaller files. From one smaller pdf file, I can see the binary content of a smaller pdf file by
cat smaller.pdf | less, which contains a readable pdf format specific string
So I tried:
sudo grep -a -C 500 'http://flask.pocoo.org/docs/1.0' /dev/sda4 > /tmp/test/recover
Because those small files and the lost file both contain the string, and
-C 500is too arbitrary to specify the begin and end of a file. I am not sure it can produce useful results.
I was wondering what ways I may try to recover the pdf file?