/lost+found is an important directory which is useful for recovering files which are not properly closed due to many reasons such as power failure. Lost+Found is created by the system at the time of Linux OS installation for each partition we create. In other words, we can say the mounted folder contains this lost+found folder. This folder contains the files with no links and files to be recovered. Any file to be recovered is kept in this folder. fsck command is used to recover these files.

How to Restore files from lost+found

1.If you are unable to boot and seeing the screen “Continue to wait; Press S to skip mounting or M for manual recovery” due to file system error in / and /home partitions. Then select the recovery option.

How to Restore files from lost+found Method 2: Use the script to automatically recover files

2.Run fsck on both / and /home file systems. 3.If you are having trouble in getting fsck cleared for /home then use: 4.Now you would be able to pass /home from fsck successfully. 5.If you will try mount /home there won’t be any user files excpet lost+found directory. Run “df -h” and you will see that your file system will be using the same space as before the crash because all the files are in the lost+found directory and we are going to recover them. 6.Now in the lost+found folder, you will see that there are a large number of folders without a name and scrutinizing each one will waste so much of your time. So next we should run “file *” to know which type of file we are dealing with. 7.Now let’s filter out the result because we just want the directory to be included in our result. So run “file * | grep directory > /root/list.dir” command. 8.Next, edit /root/list.dir to make it a script to show the list of files in each directory. Edit the file to make it a script using vi, vim, nano. Add set -v to the first line and add ‘ls -l‘ to the beginning of every other line. 9.Now make the file executable then run it and redirect the output to a file: 10.Now search for the file e.g. Desktop in the dir.out output file. The result will be something like this: 11.The above output specified that the home directory is #7733249. Now to restore the home folder just mv the folder: Note: Replace your username with the actual username of your Linux installation.

Method 2: Use the script to automatically recover files

First, run “sudo -i” or a “sudo su –” and then run the below script which runs on filesystem /dev/sd?? and outputs to /tmp/listing: That’s it you have successfully learned How to Restore files from lost+found but if you still have any question regarding this article feel free to ask them in the comment’s section.

How to Restore files from lost found - 59How to Restore files from lost found - 20