mklost+found
Create lost+found directory on a filesystem
TLDR
Create a lost+found directory in the current directory
SYNOPSIS
mklost+found [-n] [-i count] [-V] filesystem
PARAMETERS
-i count
Reserve count inodes for lost+found (default: 8192)
-n
Do not create lost+found if missing; check only
-V
Print version information and exit
DESCRIPTION
mklost+found is a utility from the e2fsprogs package designed to create or update the lost+found directory on ext2, ext3, or ext4 filesystems. This special directory is crucial for fsck (filesystem check) operations, where it stores recovered orphaned inodes—files or directories without valid directory entries—during filesystem repairs.
Running mklost+found preallocates a directory structure with a default of 8192 inodes and 2 blocks per inode, ensuring sufficient space for fsck recoveries without fragmentation issues. It must always be executed on an unmounted filesystem to prevent data corruption, as it directly manipulates the filesystem's inode table and block allocation.
If the lost+found directory already exists, the command verifies and potentially expands it. The -n option allows dry-run checks without modifications. This tool is typically invoked manually after formatting a new filesystem with mke2fs if lost+found is missing, or when fsck reports insufficient space. It enhances filesystem reliability by preparing for common recovery scenarios in Linux environments.
Proper usage avoids runtime errors and ensures robust data recovery capabilities.
CAVEATS
Requires unmounted ext2/ext3/ext4 filesystem; root privileges needed. Fails on non-ext or mounted filesystems.
EXAMPLE
mklost+found /dev/sdb1
Creates lost+found on unmounted /dev/sdb1.
mklost+found -i 16384 -n /dev/sdb1
Checks/reserves 16384 inodes without creating.
HISTORY
Part of e2fsprogs since early 1990s, developed by Theodore Ts'o for Linux ext2 filesystem; evolved with ext3/ext4 support.


