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.
jcalvinowens [3 hidden]5 mins ago
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.
adrian_b [3 hidden]5 mins ago
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.
Eikon [3 hidden]5 mins ago
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).
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.
FerretFred [3 hidden]5 mins ago
In a couple of decades running Linux installations of all flavours, I have never seen anything in lost+found!
pixl97 [3 hidden]5 mins ago
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.
Sophira [3 hidden]5 mins ago
The occassional "Drive has not been checked in <n> 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.)
lokar [3 hidden]5 mins ago
You need to use worse hardware and bad power :)
pkaye [3 hidden]5 mins ago
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.
doublepg23 [3 hidden]5 mins ago
Thank you for your service!
marcosdumay [3 hidden]5 mins ago
And more concurrent writes.
But I think ext4 will only let things appear there if you change some default flags.
FerretFred [3 hidden]5 mins ago
Umm .. how about a Raspberry Pi Zero 2W powered by a 2000MaH " lipstick style" powerbank?
arendtio [3 hidden]5 mins ago
Same here. And I had some pretty f**ed up file systems.
At one point, I had one where the directory structure was completely broken and had circles in it (broken SSD). To be fair, in that particular case, I did not look for lost+found and just wrote a tool to extract the data manually that I was looking for.
JdeBP [3 hidden]5 mins ago
That's what the answers are missing, of course. In some filesystem formats, it's possible either to recover completely from a journal/intent log, or at least to recover everything to the point that recovered files can be placed into the correct directory.
mixmastamyk [3 hidden]5 mins ago
Have to run fsck. This used to be forced about once a month but don’t remember it happening in the last decade or so.
int0x29 [3 hidden]5 mins ago
My SD cards have always had stuff in that folder. It scares me. I try not to look
anonu [3 hidden]5 mins ago
glad to see that Stack Overflow (or stackexchange.com) is still a thing.
gberger [3 hidden]5 mins ago
It's a question from 2011...
orwin [3 hidden]5 mins ago
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)
robrain [3 hidden]5 mins ago
(2012), maybe?
JdeBP [3 hidden]5 mins ago
It is StackExchange. So in theory someone could modernize it at any time.
robrain [3 hidden]5 mins ago
Indeed and I just saw it was edited in 2012 - originally posed in 2011, answers last updated in 2014.
deadbabe [3 hidden]5 mins ago
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.
yndoendo [3 hidden]5 mins ago
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.
shevy-java [3 hidden]5 mins ago
I keep everything hidden there.
In reallife I would rename this to "trash".
undebuggable [3 hidden]5 mins ago
lost+found is the Thumbs.db and .DS_Store of Linux
autoexec [3 hidden]5 mins ago
More like a FOUND.000 folder or a root directory filled with .CHK files
pixelesque [3 hidden]5 mins ago
Not really, as it's only once per file system mount, whereas those Windows and MacOS files are sprinkled in most directories with images and almost every non-network drive directory respectively.
jmclnx [3 hidden]5 mins ago
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
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.
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.
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.
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...
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.
fsck on large hard drives was scary on how long it could take to finish.
(At least this is what my memory is telling me. I could be mistaken, but that's what I remember.)
But I think ext4 will only let things appear there if you change some default flags.
At one point, I had one where the directory structure was completely broken and had circles in it (broken SSD). To be fair, in that particular case, I did not look for lost+found and just wrote a tool to extract the data manually that I was looking for.
Thing is, any time I try to replicate something like that, I basically get a flippant response saying to go look elsewhere.
I also respect human responses over AI ones every day that ends in Y.
In reallife I would rename this to "trash".