[comp.unix.wizards] inode 1

npl@cbnewsi.att.com (nickolas.landsberg) (01/29/91)

If memory serves correctly, the first version of Unix I worked with
(V5) used inode 1 for the root inode of mounted file systems.  Somewhere
in the time frame of 1978 or so, the root inode was redefined as 2
and inode 1 was "reserved for future use."  (The future has not yet
arrived, I guess.)  Can anyone with a better memory pin down exactly
which version of Unix changed the magic 1 to a magic 2?

Nick Landsberg

guy@auspex.auspex.com (Guy Harris) (01/30/91)

>Not knowing a lot about the implementation of inodes, I can only guess as to
>why inode 1 is empty and unnamed.  Sometimes, when people implement a linked 
>list or other related data types, they have a dummy header node to the list.
>What this does is eliminate the need of handling certain special cases when
>adding or deleting to or from the front of the list, which produces more 
>easily readable source code.  The overhead of one additional node is 
>negligible.  Maybe that's why the first inode is unamed and empty...

Nope.  This was discussed recently in "comp.unix", I think.  In V7, the
root inode was moved from inode 1 to inode 2; the intent was apparently
to have inode 1 be the "bad block file", to which all disk blocks
unusable due to medium errors would be assigned.  "mkfs" had a
half-implemented mechanism to do this; it would call a routine to ask if
a block is bad and, if so, assign that block to inode 1 - but the
routine never said the block was bad.  Some, perhaps all, utilities that
scanned the ilist would skip inode 1 for certain purposes.

The ilist wasn't a linked list in V7, so the dummy header node idea
doesn't apply.

richard@aiai.ed.ac.uk (Richard Tobin) (01/30/91)

In article <1991Jan28.230014.27674@cbnewsi.att.com> npl@cbnewsi.att.com (nickolas.landsberg) writes:
>Can anyone with a better memory pin down exactly
>which version of Unix changed the magic 1 to a magic 2?

It was 1 in 6th edition, 2 in 7th edition.  No, I don't have a better
memory, just more manuals :-)

>the root inode was redefined as 2 and inode 1 was "reserved for future use."

The 7th edition manual says "I-node 2 is reserved for the root
directory of the file system, but no other i-number has a built-in
meaning".  I can't see any mention of the use of inode 1.

Next question: when did i-nodes become inodes?

-- Richard
-- 
Richard Tobin,                       JANET: R.Tobin@uk.ac.ed             
AI Applications Institute,           ARPA:  R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk
Edinburgh University.                UUCP:  ...!ukc!ed.ac.uk!R.Tobin