Ashish Barot Blog Popular Posts

Tuesday, July 20, 2021

What is lost+found directory on Linux?

Many times while working on Linux system we come across the "lost+found" directory. 

So what is this directory? What is use of this directory? Let's try to understand it.  

"lost+found" directory on Linux Server

/lost+found directory can be accessed by “root” user on Linux Server

Do sudo su - and become root user

This directory contains recovered bits of corrupted files here

Let’s understand with some scenario

Sometime  power off of Linux server happen  abruptly, and it might be possible that some data writing operations are in progress on server.

Now, when we restart our Linux Server next time, the Linux FileSystem will do "FileSystem Check" with fsck command and all corrupted data / files will be placed in "lost+found" directory 

fsck command on Linux 

If we check the man page of "fsck" command, we will find that, it is mainly used for repairing various Linux File System

fsck - check and repair a Linux filesystem

fsck - This command find out some bits / orphaned objects / corrupted files on Linux / Unix Filesystem

After completing its operation fsck, command will store all such recovered files in "lost+found" directory.