Bug 70600 - fsck(8) throws files away when it can't grow lost+found
Summary: fsck(8) throws files away when it can't grow lost+found
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-18 03:20 UTC by Charles Sprickman
Modified: 2017-12-31 22:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Charles Sprickman 2004-08-18 03:20:21 UTC
When fsck is run on a well-trashed partition that has a large number of files/directories (for example a mail server using Maildirs, a news server, large office file server), there seems to be some internal limit on the number of directories and/or files that fsck can create within lost+found.  This results in many possibly recoverable files being deleted.

Fix: 

I don't really have any C skills, but on a box where I'm attempting recovery off of a dd image of a trashed fs, I've modified "dir.c" like so to make fsck just exit when it can no longer add files to lost+found:

if (makeentry(lfdir, orphan, (name ? name : tempname)) == 0) {
                pfatal("SORRY. NO SPACE IN lost+found DIRECTORY");
                printf("exiting...\n\n");
                exit (99);
                return (0);
        }

I then mount the fs r/w, copy off everything in lost+found, rm -rf lost+found, unmount, and then run fsck again.  I keep doing this until it's finished.  

I imagine someone more familiar with fsck could have it do something else at that point; like create a "lost+found1" directory and keep incrementing.  That's my best guess as to how to approach this.

Thanks,

Charles
How-To-Repeat: Trash a filesystem badly. :)  Then run fsck on it.  At some point, fsck will start spitting out the error "SORRY. NO SPACE IN lost+found DIRECTORY".  Since one is probably running with "-y" due to the large number of prompts a bad fs will have, from that point on everything fsck tries to "reconnect" into lost+found gets trashed.  You have lost possibly good data at that point.
Comment 1 Bruce Cran freebsd_committer freebsd_triage 2010-09-24 21:49:10 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:35 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped