Live data from Hacker News

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

unix.stackexchange.com

21–30 of 95 posts

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

#21
I have a book on my bookshelf, Eric Foxley's Unix for Super-Users. It was published in 1985, and it answers this question on page 52, the first page listed for the entry 'lost+found' in its index.

This is surely not the earliest book mention, is it? (It'll be in earlier man pages, of course.) Google Books does not give me an earlier one, although it does yield another 1985 book.

Fun fact: Foxley cautioned that lost+found must be pre-sized ahead of time, because the fsck of the time did not grow the directory to fit found files.

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

#22
post #5

In a couple of decades running Linux installations of all flavours, I have never seen anything in lost+found!

You need to use worse hardware and bad power :)

And more concurrent writes.

But I think ext4 will only let things appear there if you change some default flags.

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

#24
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.

Even with journaling, you might need one. ZeroFS [0] almost had a lost+found directory (even with the WAL enabled), because you might have consistency issues between your in-memory state and what was flushed, and especially in what order.

ZeroFS ended up not needing recovery at all through atomic, strictly ordered commits [1], but it was far from trivial (and not just a matter of requiring a WAL).

[0] https://github.com/Barre/ZeroFS

[1] https://github.com/Barre/ZeroFS/blob/main/zerofs/src/fs/writ...

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

#25
post #17

In a couple of decades running Linux installations of all flavours, I have never seen anything in lost+found!

Yea, run an old kernel with ext2 on a busy system writing a bunch of small files and have a power supply fail and you'll end up with something there. fsck on large hard drives was scary on how long it could take to finish.

The occassional "Drive has not been checked in days, forcing check" message on bootup got annoying sometimes, yeah. It could easily take tens of minutes to finish, exactly when I wanted to use the computer!

(At least this is what my memory is telling me. I could be mistaken, but that's what I remember.)

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

#26
post #23

glad to see that Stack Overflow (or stackexchange.com) is still a thing.

they offer private instances to school too, where moderation is left to school policy, and mine seems to be good enough to use whenever i have frontend questions (i'm 10 year into my career and still use my juniors to answer my frontend questions, i think i won't ever change)

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

#28
post #5

In a couple of decades running Linux installations of all flavours, I have never seen anything in lost+found!

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.
Post reply on HN