From blocks to files (on a UNIXpc)

Brant Cheikes brant at manta.pha.pa.us
Fri Feb 10 15:13:15 AEST 1989


You all know the question.

In article <848 at ttrde.UUCP> pfales at ttrde.UUCP (Peter Fales) writes:
>As it turns out, I am working on a program that does exactly this.
[...]
>My program is a few weeks
>(months?) away from being a useable product, but I can post it if there
>is enough interest.

I'm interested, so either post it or mail it to me, thanks.

>The way I am doing it - the only way so far as I know - is to search 
>through the inode list, and look the list of blocks that belong to
>each inode.  Then you can do a find -inum to find the file with that
>inode.

This is correct, though you should not overlook the freelist.

>There are a few other things to consider.  For example, the bad block
>may be in the swap area, or (shudder) the inode list.

I believe these are easy computations given knowledge of the sizes of
partitions 0, 1, and 2, and the total number of inodes.  My
understanding of the Unix filesystem is that the inode blocks are the
first blocks of partition 2.  So given 800 total inodes, and 8 inodes
per block, the first 100 blocks of partition 2 are reserved for the
inodes.
-- 
Brant Cheikes
University of Pennsylvania, Department of Computer and Information Science
brant at manta.pha.pa.us, brant at linc.cis.upenn.edu, bpa!manta!brant



More information about the Unix-pc.general mailing list