Foremost - trouble scanning folder

I was very excited when I found your excellent article about using foremost to scan for files. I had LinuxMint on an old Dell from a friend, and the harddrive got messed up and the computer was stuck somewhere in the boot process. I tried to remember to backup my files but didn’t have any automatic process for it, so had a number of documents on the desktop I lost.

My friend was able to recover a "Lost and Found’ folder from the harddrive, and wiped and re-installed Mint on the Dell so I could use it again. He put the “Lost and Found” folder on the desktop. I tried looking through it, and was bummed because I couldn’t tell if there were any actual files in there or not. There was so much in there it would have taken me hours and hours to look through it all. I also wondered if any files were in fragments and could be repaired?

After some searching, I found your article about foremost, and thought it sounded like the perfect thing to use to scan the Lost and Found folder to see if there are any files I can recover from it. But when I tried installing and using foremost as per the instructions in your article, I couldn’t make it work.

I have the "Lost and Found’ folder currently on the desktop of the computer, so I thought I could type the pathway to that file folder in for foremost to scan (I used the command $ sudo foremost -i XXX — putting the filepath for the folder where the X’s are), but it didn’t work and the whole process froze and I had to force quit. Should I put the folder on a thumbdrive and specify the filepath to that USB drive? Trying so hard to recover whatever files I may have lost!

Thanks so much for your help!!

Elizabeth

Hi Elizabeth,

Welcome to our forums.

foremost is used to recover deleted files from a disk or disk image, not from the lost+found directory. So this is not a tool for your situation. You could try checking the contents of your salvaged directory using file which will tell you that data is contained in the files, for example:

$ file \#110105126 
#110105126: UTF-8 Unicode text

So in the above example I can see the contents with any text editor, and decide if I need it. If so, I could restore it with something like:

$ mv \#110105126 /home/myname/Documents/myimportanttextfile.restored

Okay, I will try the file command that you recommend. Thank you so much for your help!

I have so many questions! I will try to be succinct and to the point.

a) Is there any chance that I would be able to recover files like pdfs, documents, images, music files, using the file command prompt?

b) Are the above-mentioned kinds of files, once in the Lost and Found folder, usually in pieces or otherwise rendered unreadable as their original file formats? If so, does that mean recovery of the data is impossible?

c) Would I substitute the Lost and Found folder’s pathway for the #110105126 in your example?

d) Could I have used foremost to scan the drive prior to it being wiped for a better chance at recovering my files, if I had known about it?

e) Would it be possible to use foremost to scan the hard drive from a Lenovo I had, which also broke down recently? I have taken out the hard drive and bought the cable to connect the hard drive to another computer via usb.

THANK YOU!!! :smiley:

Wow, lot of questions :slightly_smiling_face: That’s a good thing. I’ll try to answer to all of them the best I can.

a) Yes, that’s the point.

b) The files you’ll find in the lost+found directory should be intact, only their names and filesystem paths lost, hence the unreadable auto-generated filenames. They should be readable, if not binaries. The file utility mentioned above can tell you if they are binaries, text, etc.

c) Yes, you could do something like:

$ file <path>/lost+found/<some-file>

My example assumes I am already in the lost+found directory.

d) Yes, that’s what foremost is for.

e) If the drive is readable by the operating system, then the answer is yes, you certainly could give it a try.

Thank you so very much for helping me!

I will try to run the file utility, as you recommend. I hope I get the command right for it to scan all the files in the lost and found folder. Same goes for the Lenovo hardrive. If I have trouble, I will be back! :wink:

Actually I will be back anyway - I have been using Linux Mint on that old Dell for years now and never really thought to reach out on a forum, but ya’ll have been so responsive and helpful, it is motivating me to put more of an effort into actually learning more about how to really work with it as opposed to just using it like I would a windows pc. :blush:

1 Like

Okay, well I have finally had a chance to sit down and see if I can run file to scan the lost and found folder, and I am already stuck!

I am attaching a screenshot. I am so sorry for not understanding this, I’m sure it is super easy.

Hi,

Apologies for my interjection but based on the screenshot provided it seems that you have some issues with linux filesystem navigation.

Try absolute path:

$ file  /home/guesswho/Desktop/OLD-MINT/lost+found

Or you can try also a relative path given that you are logged in as guesswho user:

$ file ~/Desktop/OLD-MINT/lost+found

Please read at least the following two sections from our Linux commands tutorial:

Lubos