What is the purpose of the lost+found folder in Linux and Unix? (2014)(unix.stackexchange.com) |
What is the purpose of the lost+found folder in Linux and Unix? (2014)(unix.stackexchange.com) |
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".