So, someone asked you to clean up a file system on your AIX logical partition. And you did. Now when you cd to the mount point, there's nothing in it. Zilch. Zip. Nada. Not even that mysterious lost+found directory.
THIS IS BAD
But don't worry. Help is on the way.
What's the deal with lost+found?
Someone once decided that it would be a great idea to have an AIX directory with a plus sign in its name. So every journaled file system (and enhanced journaled file system - also known as "JFS2") should have a directory in it called:
Now this directory is almost always empty, but it does come in kind of handy when you have orphaned files and directories. How do you get them? I don't know. Probably a hardware failure would be the most common reason.
File System Checks using fsck
If you ever have need for running a file system check using the AIX fsck command, AND you've been a bit overzealous clearing out that file system (including the lost_found directory), then you
probably definitely want to have that directory.
The fsck command reconnects any orphaned files and directories by placing them in the lost and found directory with an assigned i-node number.
How do you create it?
Log in with root permissions, cd to the file system which is missing its lost+found directory, and then run the following command:
No, that's not a typo. That's the real command, plus sign 'n all. Is that the longest ever command in AIX (before you get to the parameters and flags)? Maybe. But it's worth knowing.
So, next time someone decides to wipe out an entire file system and all that sails in her, be sure to keep the lost+found directory, or to run this command to recover it:
And here's the link to the fsck command: