[comp.unix.wizards] cpio and lost+found

trb@ima.UUCP (Andrew Tannenbaum) (11/14/86)

Did you ever notice...

If you save a file system with cpio, it doesn't save the contents of
each directory file, it just saves the directory as an empty entity and
it gets filled with the appropriate files.  While this is the correct
action in most cases, it is wrong in the case of the lost+found
directory.  (It's supposed to have a bunch of spare empty slots, but it
gets created by cpio with no spare empty slots.)

Does anyone deal with this in a rational way?  If you restore a filesystem
like this, you should run a mklost+found program which creates a bunch of
files and then proceeds to delete them, leaving empty directory slots.

	Andrew Tannenbaum   Interactive   Boston, MA   +1 617 247 1155

jc@cdx39.UUCP (John Chambers) (12/05/86)

> 
> If you save a file system with cpio, it doesn't save the contents of
> each directory file, it just saves the directory as an empty entity and
> it gets filled with the appropriate files.  While this is the correct
> action in most cases, it is wrong in the case of the lost+found
> directory.  (It's supposed to have a bunch of spare empty slots, but it
> gets created by cpio with no spare empty slots.)
>
There is a secondary problem I've run across.  Sometimes a lost+found
directory gets full, nobody notices, and during the next boot there's
not enough space.

Both of these problems can be [almost-]solved, at the price of a slightly 
slower boot, by having your /etc/rc include a bunch of lines like:
	(cd /        ; mklost+found)
	(cd /usr     ; mklost+found)
	(cd /usr/lib ; mklost+found)
and so on for each mounted file system.   You might want to write 
a version of mklost+found that doesn't try to create the directory,
to get rid of the complaints about lost+found already existing.

-- 
	John M Chambers			Phone: 617/364-2000x7304
Email: ...{adelie,bu-cs,harvax,inmet,mcsbos,mit-eddie,mot[bos]}!cdx39!{jc,news,root,usenet,uucp}
Smail: Codex Corporation; Mailstop C1-30; 20 Cabot Blvd; Mansfield MA 02048-1193
Clever-Saying: For job offers, call (617)484-6393 evenings and weekends.