Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!cmcl2!phri!roy From: roy@phri.UUCP (Roy Smith) Newsgroups: comp.unix.wizards Subject: Re: help with missing lost+found! Message-ID: <2867@phri.UUCP> Date: Sat, 22-Aug-87 00:08:46 EDT Article-I.D.: phri.2867 Posted: Sat Aug 22 00:08:46 1987 Date-Received: Sun, 23-Aug-87 08:21:18 EDT References: <180@LOGICON.LOGICON.UUCP> <2836@phri.UUCP> <657@hplabsz.HPL.HP.COM> Reply-To: roy@phri.UUCP (Roy Smith) Organization: Public Health Research Inst. (NY, NY) Lines: 31 In article <657@hplabsz.HPL.HP.COM> mayer@hplabsz.UUCP (Niels Mayer) writes: > I vaguely know what the lost+found directory does for a disk partition. Can > someone explain the reason for needing 100 empty files in the directory? You don't need empty files in the directory, but empty slots. It goes like this. When you make a file, the directory gets an entry in it containing the file name and the inode number. When you remove a file, the inode number is set to zero, which indicates that the directory slot is unused. Next time you go to create a file, if there are any unused slots, the kernel will reuse a slot. If there aren't any empty slots, the kernel will grow the directory and make a new slot. Fsck knows how to take unreferenced files and put them in /lost+found, with made-up names (#i, where i is the inode number). It does not know, however, how to grow a directory, so if it has to reattach a file and there aren't any empty slots in the lost+found directory, you're screwed. So, when you create a lost+found, you make lots of empty files there and then remove them all, leaving lots of empty slots for fsck to use if it ever has to. Since directories don't shrink, these slots stay around, empty, until needed. With the coming of 4.3, some of this has changed. Fsck is supposed to know how to grow directories, and directories are supposed to be able to shrink under the right conditions. As somebody has already pointed out, given that you are working with a addled file system to begin with, you probably shouldn't trust that fsck can grow the lost+found directory if it has to. -- Roy Smith, {allegra,cmcl2,philabs}!phri!roy System Administrator, Public Health Research Institute 455 First Avenue, New York, NY 10016