Question
========
The “lost+found” directory from one of my filesystems is gone. How do I recreate it?

Answer
======
The directory in the root of local filesystems called “lost+found” is used when fsck needs to reattach files and directories into the filesystem tree, but it cannot determine what the file or directory name was, or what directory they were in.

The fsck utility copies them into this directory, and names them numerically based on the inode they are using.

There are two ways to recreate this directory:

Unmount the filesystem and run fsck against it. The fsck utility will recreate the lost+found directory.
# umount /myfs
# fsck /myfs
Use the utility /usr/sbin/mklost+found to recreate the directory. This utility will create the directory, put a few zero-length files in it to create slots in the directory table, then remove those files. Running this does not require unmounting the filesystem.

Advertisements