michi@anvil.oz (Michael Henning) (04/11/89)
I just did a "find / -inum 1 -print" on an AIX and a Xenix 386 system. As it turns out, inode 1 is not used. The root inode of every file system is 2. Can anyone tell me why inode 1 is not used anywhere ? It seems that it could be used, since if 0 indicates that a directory entry is free, why not use inode 1 like any other inode ? Michi. -- | The opinions expressed are my own, not those of my employer. | | | | Michael (Michi) Henning | | - We have three Michaels here, that's why they call me Michi |
jfh@rpp386.Dallas.TX.US (John F. Haugh II) (04/15/89)
In article <352@anvil.oz> michi@anvil.oz (Michael Henning) writes: >I just did a "find / -inum 1 -print" on an AIX and a Xenix 386 system. As >it turns out, inode 1 is not used. The root inode of every file system is 2. >Can anyone tell me why inode 1 is not used anywhere ? It seems that it >could be used, since if 0 indicates that a directory entry is free, why >not use inode 1 like any other inode ? Because in ages past someone wanted to use inode 1 to contain the list of bad blocks. If you use fsdb to create a file with inumber 1, it should function just fine. The root inode is defined to be 2 in <sys/param.h>, there is no reason it can't be defined to be 1. Non-portable programs not withstanding :-( ... -- John F. Haugh II +-Quote of the Week:------------------- VoiceNet: (214) 250-3311 Data: -6272 | "Porsche does not recommend InterNet: jfh@rpp386.Dallas.TX.US | exceeding any speed limits" UucpNet : <backbone>!killer!rpp386!jfh +-- -- Porsche Ad ------------
yuf@mentor.cc.purdue.edu (Kyle Grieser) (04/15/89)
In article <352@anvil.oz> michi@anvil.oz (Michael Henning) writes: >I just did a "find / -inum 1 -print" on an AIX and a Xenix 386 system. As >it turns out, inode 1 is not used. The root inode of every file system is 2. >Can anyone tell me why inode 1 is not used anywhere ? It seems that it >could be used, since if 0 indicates that a directory entry is free, why >not use inode 1 like any other inode ? The comments given in /usr/include/sys/fs.h answer this question pretty well if you wish to browse. Inode 1 is not used for historical purposes. Inode 1 used to have bad blocks linked to it. It is no longer used for this, but some things assume that it is still true. Thus, the root inode is still #2. ----- Kyle Grieser mentor.cc.purdue.edu!yuf, yuf@mentor.cc.purdue.edu
itwaf@dcatla.UUCP (Bill Fulton [Sys Admin]) (04/15/89)
In article <352@anvil.oz> michi@anvil.oz (Michael Henning) writes: >I just did a "find / -inum 1 -print" on an AIX and a Xenix 386 system. As >it turns out, inode 1 is not used. The root inode of every file system is 2. >Can anyone tell me why inode 1 is not used anywhere ? It seems that it I heard a terrific explanation of this at the Winter Usenix. During a Sys5 tutorial, the speaker, who was from AT&T and apparantly very close to the code, relayed the following story as an explanation for starting everything at inode 2: Back when Unix was being developed (while everyone else was banging rocks together :-), one of the guys wanted to prove that there were no 'magic cookies' in his code. At this time, inode 1 WAS the first inode used. To prove his point, he changed the definition of the first inode to be '2'. Well, he was right, everything worked fine. Problem is ... nobody set it back to '1' !!! Maybe apocryphal, but damned cute story! Bill Fulton ..!gatech!dcatla!itwaf dcatla!itwaf@gatech.uucp
terryl@tekcrl.LABS.TEK.COM (04/15/89)
In article <352@anvil.oz> michi@anvil.oz (Michael Henning) writes: >I just did a "find / -inum 1 -print" on an AIX and a Xenix 386 system. As >it turns out, inode 1 is not used. The root inode of every file system is 2. >Can anyone tell me why inode 1 is not used anywhere ? It seems that it >could be used, since if 0 indicates that a directory entry is free, why >not use inode 1 like any other inode ? Yes, Grasshopper, come and eat from the Tree Of Knowledge... Many, many (I mean MANY!! (-:) moons ago, inode #1 was supposedly used as a file that would contain the bad blocks of the file system, just so the blocks would never get allocated to a real-live file (I say supposedly, be- cause I have never seen it myself, but that's the way it's been handed down by word of mouth throughout the ages....).
ed@mtxinu.COM (Ed Gould) (04/15/89)
>>Can anyone tell me why inode 1 is not used anywhere ? >I heard a terrific explanation of this at the Winter Usenix. During a >Sys5 tutorial, the speaker, who was from AT&T and apparantly very close >to the code, relayed the following story as an explanation for starting >everything at inode 2: >Back when Unix was being developed (while everyone else was banging rocks >together :-), one of the guys wanted to prove that there were no 'magic >cookies' in his code. At this time, inode 1 WAS the first inode used. To >prove his point, he changed the definition of the first inode to be '2'. >Well, he was right, everything worked fine. Problem is ... nobody set it >back to '1' !!! This is rediculous, and the stuff of which urban legends are made. In the Sixth Edition and before, inode 1 was indeed the root of the file system. When the file system was modified (one of the changes between the Sixth and Seventh edition), the root was moved to inode 2, and inode 1 was reserved for bad block handling. This method of bad block management was never widely implemented, if anyone ever actually did it at all. The notion that there were "no magic cookies" might be interestig, but does not relate to inode numbers. There are certainly constants in Unix that are difficult to change, even though they are always referenced by name. -- Ed Gould mt Xinu, 2560 Ninth St., Berkeley, CA 94710 USA ed@mtxinu.COM +1 415 644 0146 "I'll fight them as a woman, not a lady. I'll fight them as an engineer."
hutch@rawfish.celerity (Jim Hutchison) (04/18/89)
In article <352@anvil.oz> michi@anvil.oz (Michael Henning) writes: >[...] As >it turns out, inode 1 is not used. The root inode of every file system is 2. >Can anyone tell me why inode 1 is not used anywhere ? It seems that it >could be used, since if 0 indicates that a directory entry is free, why >not use inode 1 like any other inode ? I am not sure of the historical significance, but inode 1 was a good place in system III to hang bad blocks. I recall using fsdb to do this, love fsdb, hate system III. :-) This enabled me to dismount the file system in question, do work on it, and re-mount it without going into single-user. Later when I had more time, I usually made a point of re-formatting the disk and getting the bad track information updated. It works as a temporary fix, and is a lot nicer than having a file in root called BAD_BLOCKS which will get tagged by every verification program you run. /* Jim Hutchison {dcdwest,ucbvax}!ucsd!celerity!hutch */ /* Disclaimor: I am not an official spokesman for FPS computing */
guy@auspex.auspex.com (Guy Harris) (04/18/89)
>...and inode 1 was reserved for bad block handling. This method of >bad block management was never widely implemented, if anyone ever actually >did it at all. As I remember, it was half-implemented in the V7 "mkfs"; there was a routine that would be called for every data block in the file system and, if it returned true, the block would be assigned to inode 1. (It looks as if that's still there in the S5R3 "mkfs".) However, the routine always returned false....