The lost+found folder

Have you ever seen the lost+found folder in a root directory and wondered about what it could be? You might have wondered if you are a beginner in Linux. The lost+found folder is present in operating systems like Linux, macOS and Unix-like operating systems. The name itself is bit interesting, isn’t it? What was the first thought came into your mind after reading that interesting folder’s name?

So, lost+found(not Lost+Found) is a directory at the root of Linux and Unix operating systems. If you fire find command on a terminal you will see where the folder lies

find / -name lost+found

While talking about lost+found folder fsck(filesystem check)comes into picture. The fsck is the system utility tool to check the consistency of a file system in Linux and Unix operating systems. The fsck goes through the system and try to recover corrupt files. The reason behind file corruption can be power failure, improper shutdown or kernel panic.

You can check and repair your filesystem by running,

fsck

fsck might find data which might look like a file with inode and without name of the file on system. Eventhough the data cannot be accessed, it occupies the space.

We can have our corrupted and deleted files back by just reparing filesystem by fsck. After reparing filesystem all corrupted and deleted files get arrived into lost+found directory, but their information is gone. Those files had a name and location now it is not present anymore. So what fsck did is to make available all lost files found into a directory name lost+found. Files that are typically lost because of directory corruption would be linked in that filesystem’s lost+found directory by inode number since name of file gets erased from system.

The files that show up found folder still have data. Nevertheless their names are erased. The another reason files can show up in lost+found directory is inconsistent state of filesystem due to software hardware bug. The file which are present in the lost+found folder might contain data which is useful or not useful. Files can be out of date because we do not know how much serious damage our filesystem have had!
Some files can be recovered whether some cannot!It depends on how much bad damage has filesystem gone through.

Note : If you delete lost+found folder by mistake,
mkdir would not work in that case go with mklost+found. For more information there is man page available.

man mklost+found

If you are willing to see contents of lost+found run follow commands on terminal:

sudo su

or

su

cd /lost+found

ls

If you have lost some data you may give it a try to recover it by examining lost+found folder. You can also recover a complete file and put back to its previous location.