#### "The Linux Gazette...making Linux just a little more fun!"

# The Answer Guy

#### By James T. Dennis, linux-questions-only@ssc.com
LinuxCare, http://www.linuxcare.com/

### Inodes Numbering: An Academic Question

From mcp on Sat, 01 May 1999

Hello,
Could u pls explain me As the inodes of unix file system are store in disk in the form of linear arrays,the index value doesn't start from zero.But generally in 'C' the array index starts from zero.What is the reason
Thanx
Prakash

> Hmm. This is one of those questions where it's hard to start on an answer. The set of premises upon which you're basing your question is so shaky that the question itself is hard to grasp.

> First, it seems to be a question about Unix internals.

> "Why isn't there an inode 0?"

> Because the programmers of the Unix implementation that you're looking at may not have wanted to start numbering at zero. Of course, I'm not sure that there is no inode number zero. I'm not sure how you can be sure, either.

> It may be that the badblocks list is stored in inode zero (on some filesystems). At least in some filesystems the list of bad blocks is managed by "allocating" them to a special system inode. They effectively become part of the "bad blocks" file. Since this is done during the creation of the filesystem (before even a base directory is created) it would logically follow that this would have the lowest numbered inode on a given fs.

> I wouldn't say that inodes are "store in disk in the form of linear arrays." Inodes are stored in a filesystem in whatever manner the designer of a fileystem chooses to store them. They may be represented as arrays in most see programs --- though they are probably more often managed as linked lists of structs. They might be doubly linked, hashed/btrees of structs. I'm not a C programmer so I don't really know. Of course we could go look at the code --- but I'm not even enough of a programmer to infer the overall design from a worm's eye perusal of the that.

> I've heard that some filesystems (like those in LVM --- logical volume management systems) put different ranges of inodes on each PV (physical volume). Thus they don't start numbering the inodes for a given fs at 0 or one or anything even close. There is no particular reason why they should. The inode is just an arbitrary unique identifier for all information about a file, sans it's "names" (links).

> The greater questions is: "Why?"

> Why do you ask?

##### Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 42 June 1999

###### HTML transformation by Heather Stern of Starshine Techinical Services, http://www.starshine.org/

| 1 | 2 | 3 | 4 | 5 | 6
7 | 8 | 9 | 10 | 11 | 12
13 | 14 | 15 | 16 | 17 | 18
19 | 20 | 21 | 22 | 23 | 24