Live data from Hacker News

What is the purpose of the lost+found folder in Linux and Unix? (2014)

unix.stackexchange.com

31–40 of 95 posts

Re: What is the purpose of the lost+found folder in Linux and Unix? (2014)

#31
How do questions like this make it to the top? It is an obvious thing if you search for it or ask AI, but people seem to just ignore those in favor of generating new human responses.

Thing is, any time I try to replicate something like that, I basically get a flippant response saying to go look elsewhere.

Re: What is the purpose of the lost+found folder in Linux and Unix? (2014)

#32
post #28
post #5

Earlier quoted context omitted.

You need to use worse hardware and bad power :)

I used to develop SSD firmware and one of things I worked on is making it robust to power failure. The power supplies have lots of capacitance so the voltage drop was slow so we would use a special test board that would disconnect from power and discharge fast to test it.

Thank you for your service!

Re: What is the purpose of the lost+found folder in Linux and Unix? (2014)

#34

How do questions like this make it to the top? It is an obvious thing if you search for it or ask AI, but people seem to just ignore those in favor of generating new human responses. Thing is, any time I try to replicate something like that, I basically get a flippant response saying to go look elsewhere.

Reaching HN or other sites allows for exposure to information that a person otherwise would not ask themselves.

I also respect human responses over AI ones every day that ends in Y.

Re: What is the purpose of the lost+found folder in Linux and Unix? (2014)

#35
post #2

I had a lost+found folder in all Unix file systems I used since the 80s. It's where fsck places files that it found during a scan and can't figure out to which directory they belong. Sometimes I found stuff in there. From what I googled XFS, Btrfs and ZFS don't use lost+found. It's a thing of the old not journaled filesystems and of the ext family.

XFS does use /lost+found, it calls it the "orphanage directory" and xfs_repair reparents children of corrupt directories there. Based on comments in the kernel source, it seems like the userspace fsck for JFS and F2FS will also sometimes create /lost+found. There might be more that do.

XFS filesystems do not have a "/lost+found" directory in their normal state.

In the very rare occasions when one has to run "xfs_repair", it will create a "/lost+found" directory, if it is required for recovered files.

After the repair and after investigating whether the recovered files contain useful data or not (and after moving the useful files elsewhere), one should normally delete the "/lost+found" directory, because it is no longer needed.

Re: What is the purpose of the lost+found folder in Linux and Unix? (2014)

#36
post #12
post #10

Earlier quoted context omitted.

It is StackExchange. So in theory someone could modernize it at any time.

Indeed and I just saw it was edited in 2012 - originally posed in 2011, answers last updated in 2014.

Yeah, it seems I improved a tiny tiny bit a couple of them.

Re: What is the purpose of the lost+found folder in Linux and Unix? (2014)

#37
Back in the day I accidentally deleted all my stuff because I had it all in a special dir of this user in suse Linux. When I deleted the user, yast deleted everything.

Fortunately I was using ReiserFS at the time and something about its murderous tree data structure made it trivial to undelete.

Reiser_fsck found ALL my stuff, mostly with full dir tree structure in tact and put it all in lost+found

Re: What is the purpose of the lost+found folder in Linux and Unix? (2014)

#39
post #27

lost+found is still used on OpenBSD, seems it is created when needed. Only /home has that directory on my system. IIRC, it was created when a kernel panic happened a few releases ago. Plus some files were placed in it when fsck executed on /home

Same, it's only in /home on my system also. Also /home is pretty much the only directory where I see fsck needing to do a lot of recovery after a power failure. Makes sense I guess, because that's where processes such as web browsers are likely to have lots of files open in RW mode.

Re: What is the purpose of the lost+found folder in Linux and Unix? (2014)

#40

How do questions like this make it to the top? It is an obvious thing if you search for it or ask AI, but people seem to just ignore those in favor of generating new human responses. Thing is, any time I try to replicate something like that, I basically get a flippant response saying to go look elsewhere.

Reaching HN or other sites allows for exposure to information that a person otherwise would not ask themselves. I also respect human responses over AI ones every day that ends in Y.

Why not on sundae?
Post reply on HN