
mklost+found: Create a lost+found directory
Quick start
- Use the command to create a lost+found directory in your current directory.
- This is handy after rescue operations or when a filesystem needs a place to stash orphaned inodes.
# Create lost+found in the current directory
mklost+found
What it does
- Creates a directory named exactly lost+found in the current working directory.
- The directory is created with appropriate permissions for a typical recovery workflow (owner and permissions managed by the system, usually 700).
- It does not repair inodes or recover files by itself; it simply provides a designated place for recovered items.
When to use it
- After filesystem checks (fsck) or recovery operations where orphaned data might be rehomed.
- If you need a dedicated folder to store recovered pieces temporarily during a cleanup.
- When you’re teaching or documenting recovery procedures and want a consistent workspace.
Common pitfalls
- If a directory named lost+found already exists, mklost+found may fail or do nothing depending on the version. Check first.
- It does not replace a missing lost+found at a filesystem root; that is created by mkfs.ext4 or similar during filesystem creation.
- Running in a user-writable directory might create a confusing structure; prefer a dedicated recovery workspace.
# Check if the directory exists before creating
if [ -d lost+found ]; then
echo "lost+found already exists"
else
mklost+found
ls -ld lost+found
fi
Example workflow
- Create a recovery workspace:
mkdir -p ~/recovery/work
cd ~/recovery/work
mklost+found
ls -ld lost+found
- Move recovered items into the folder as you inspect them:
mv /path/to/recovered/file.png lost+found/
Troubleshooting
- If you get a permission error, try running in a directory you own or use sudo to create the folder in a global location:
sudo mklost+found
- If you unexpectedly see an existing lost+found, verify its contents and purpose since it may be part of another process or mount.
For more details, consult the man page: https://linux.die.net/man/8/mklost+found