Subject: Re: what makes lost+found in NetBSD?
To: None <current-users@NetBSD.ORG>
From: Collatz Root <root@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 11/06/1995 22:10:22
> This might seem a bit thick of me, but which program is supposed to
> make the "lost+found" directory for new filesystems?  [...] [A]t
> present, none of my NetBSD-created filesystems have a lost+found
> directory.  I do regard this with some concern...

The 4.4 theory seems to be that it's fsck's job.  I don't really like
this, because it requires having at least one available inode and the
necessary disk blocks, but if it bothers you it's trivial to write a
little mklost+found that makes the directory, creates files in it to
grow it to size, and then cleans it out again.  I suppose the idea is
that if fsck is capable of growing lost+found, there's no reason it
can't be responsible for creating it in the first place.

Here's a first-draft skeleton mklost+found, with error checking,
include files, and frills such as command-line parsing omitted:

main()
{
 char namebuf[256];
 int i;

 mkdir("lost+found");
 for (i=0;i<16;i++)
  { sprintf(&namebuf[0],"lost+found/%d%200s",i,"");
    close(open(&namebuf[0],O_RDWR|O_CREAT,0600));
  }
 for (i=0;i<16;i++)
  { sprintf(&namebuf[0],"lost+found/%d%200s",i,"");
    unlink(&namebuf[0]);
  }
}

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu