How to Hide or Remove the lost+found Directory in Linux Partitions for Media Storage


3 views

When creating an ext2/ext3/ext4 filesystem, Linux automatically generates a lost+found directory at the root. This directory serves as a recovery placeholder for fsck (file system check) to store orphaned files during repairs. While useful for system partitions, it becomes redundant and visually distracting on partitions dedicated solely to media storage (music, videos, etc.).

There are several approaches to handle this, each with different implications:

1. Simple Renaming (Temporary Solution)

Quickly rename the directory (requires root):

sudo mv /mount/point/lost+found /mount/point/.lost+found

The dot prefix makes it hidden in standard directory listings. Note that this may be recreated after filesystem checks.

2. Filesystem Creation with Disabled lost+found

When initializing a new ext4 filesystem:

sudo mkfs.ext4 -m 0 -O ^has_journal /dev/sdX1

The -m 0 reduces reserved blocks, while -O ^has_journal creates ext2 (no journal), which typically doesn't create lost+found. Warning: This affects filesystem reliability.

3. Permanent Removal (Not Recommended)

For advanced users who understand the risks:

sudo rm -rf /mount/point/lost+found
sudo tune2fs -m 0 /dev/sdX1

This completely removes the directory and reduces reserved space. Future fsck operations may recreate it.

Most file managers can be configured to hide specific directories:

  • Nautilus: Ctrl+H toggles hidden files
  • CLI: ls -I "lost+found"
  • FUSE mounts: Use hide_files option

For pure media storage, consider non-Linux filesystems:

sudo mkfs.ntfs -Q /dev/sdX1  # Windows-compatible
sudo mkfs.exfat /dev/sdX1    # Cross-platform

The lost+found directory is automatically created by filesystem utilities like ext4, xfs, or btrfs during filesystem creation. It serves as a recovery location for corrupted files after system crashes or improper shutdowns. While useful for system partitions, it may be undesirable on dedicated media storage partitions.

Option 1: Filesystem-Level Prevention
When creating the partition, use filesystem creation flags to skip lost+found generation:

# For ext4 filesystems
mkfs.ext4 -m 0 -N 0 /dev/sdX1

Option 2: Post-Creation Removal
After filesystem creation, simply delete the directory (requires root):

sudo rm -rf /mount/point/lost+found

Option 3: Cosmetic Hiding
For GUI applications, prefix the name with a dot:

sudo mv /mount/point/lost+found /mount/point/.lost+found

ext4: The directory will reappear after fsck unless using -N 0 flag
XFS: Doesn't create lost+found by default
btrfs: Uses different recovery mechanisms, no lost+found

Add post-mount commands in /etc/fstab:

UUID=1234-5678 /media/music ext4 defaults,noatime 0 2 && rm -rf /media/music/lost+found

Removing lost+found means:

  • No automatic file recovery after crashes
  • Possible warnings during filesystem checks
  • Better media library organization

For network storage, use chattr to make directory invisible:

sudo chattr +i /mnt/nas/.lost+found