Null in directory name

Chris Torek chris at umcp-cs.UUCP
Fri Mar 29 18:24:29 AEST 1985


On rereading my reply, I notice I forgot the most important piece of
information:  how to use adb to fix directories.

Well, it ain't easy.  If you need to fix the /usr directory, then first
you have to find out the file system name and inode number of /usr.
Then you run "adb -w /dev/rxxns" (where xx is the disk, n is the unit
number, and s is the partition name) and take a look at the inode for
/usr (the method for finding this is different from Unix to Unix, but
for most non-4.2's is a matter of adding an offset to the result of
multiplying the inode number the size of a disk inode.  In 4.2 you'd
have to find the right cylinder group, which is another matter....)

Anyway, dump out that inode (in whatever format it's in; look at
<sys/inode.h>) and somewhere in there will be the list of blocks that
/usr occupies.  Track those down and you'll find a bunch of "struct
direct" entries (hopefully) which represent the contents of /usr.  In
there will be the "b^@n" entry (or other corrupted entry), which is
then easily patched.
----------
Oh yes, before I forget (I did last time): there's a fourth alternative
that may be easier than any of the others.  If you "clri" the inode for
/usr, fsck will pick up all the directories that used to be under it
and deposit them in /usr/lost+found.  Then it's just a matter of
figuring out which directory is which, and "mv"ing them back into
place.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris at maryland



More information about the Comp.unix mailing list