1837985 Members
2874 Online
110124 Solutions
New Discussion

Re: inode 0 and 1

 
shri_hunter
New Member

inode 0 and 1

Why inode number 0 and 1 is not used??

and if they are reserved then for what they are reserved????

thanks in advance
-=HPUX=-
10 REPLIES 10
Hein van den Heuvel
Honored Contributor

Re: inode 0 and 1

That sounds like an excellent research question to help you learn about the Unix file systems! Sweet!

I do your research then will take you to many areas you had not studied before and that you will learn a lot about this, and several tangential topics.

When you finished your homework, be sure to share your summarized findings here.

I know I'll state the obvious by recommending you to use GOOGLE as your first tool to work this question. You may want to restrict initial answers to +site:hp.com

Good luck in you travels on the web!

If you fail this mission, then by all mean check back in a few days with details how far you came, and where you would like detailed help for specific part problems. You'll find many here eager to help!

If you do reply back then kindly sign with a real person name, preferably your own name.

Best regards,
Hein van den Heuvel
Raj D.
Honored Contributor

Re: inode 0 and 1

Hi Hunter,

Check iget.c for details, you need to know c programing.

I think swap filesystem object gets inode numbe 1 (But you cannot see it,) , and rest of the initial filesystems objects (mounted on the directories as mentioed) gets inode number 2 ,like / /stand /home /var /opt .., and 0 is not used as it does not points to a number , and inode number can have 256 or 512 bytes in length.


Also check vx_inode.h and inode.h for details.

hth,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
shri_hunter
New Member

Re: inode 0 and 1

Thanks raj..

and
Hein van den Heuvel i m bck with my real name....
Hein van den Heuvel
Honored Contributor

Re: inode 0 and 1

>> Hein van den Heuvel i m bck with my real name....

Great. I didn't know you could do that!
For future readers: When I replied to the topic the Author was indicated as "HPUX Hunter". The HPUX was clearly artificial. The "Hunter" might have been artificial, but turned out the be real. Ok.

The reason I replied is that IMHO the actual
question is irrelevant in a business context. Inode numbers are 'opaque'. Yeah, deep down they have some secret meaning, but as long as they work, who cares. And whether 0 and 1 have a special meaning would seem extra irrelevant for production purposes, but interesting for academic research.

Regards,
Hein
Raj D.
Honored Contributor

Re: inode 0 and 1

Shri,

My thinking on the earlier post wasn't entirely correct.

The root inode is the root of the file system. Inode 0 can't be used for normal purposes and historically bad blocks were linked to inode 1, thus
the root inode is 2 (inode 1 is no longer used for this purpose, however numerous dump tapes make this assumption, so we are stuck with it).

Check Berkeley.edu and Dr.Watson documentation and pages if you really interested to know more,



Enjoy,
Raj.

" If u think u can , If u think u cannot , - You are always Right . "
Raj D.
Honored Contributor

Re: inode 0 and 1

Shri (again!),

An example how it works:


/* iget isn't really right if the inode is currently unallocated!!
* ext2_read_inode currently does appropriate checks, but
* it might be "neater" to call ext2_get_inode first and check
* if the inode is valid.....
*/
inode = iget(sb, ino);
if (inode == NULL)
return ERR_PTR(-ENOMEM);
if (is_bad_inode(inode)
|| (generation && inode->i_generation != generation)
) {
/* we didn't find the right inode.. */
iput(inode);
return ERR_PTR(-ESTALE);
}
/* now to find a dentry.
* If possible, get a well-connected one
*/
result = d_alloc_anon(inode);
if (!result) {
iput(inode);
return ERR_PTR(-ENOMEM);
}
return result;

/* check further.. */



Enjoy the forum,
Have fun,
Raj.


" If u think u can , If u think u cannot , - You are always Right . "
Raj D.
Honored Contributor

Re: inode 0 and 1

Shri,

Also check the filesystem header file, fs.h from 1991 Free BSD page , it is written pretty clearly ,


http://freebsd.active-venture.com/FreeBSD-srctree/newsrc/i386/boot/dosboot/fs.h.html


Have fun,
Raj.


http://66.34.90.71/ITRCForumsEtiquette/after.html cheers.
" If u think u can , If u think u cannot , - You are always Right . "
shri_hunter
New Member

Re: inode 0 and 1

Hein van den Heuvel

yea u r right! i asked that question from academic point of view....because i m newbie for HPUX and till this date no more in a business related to HPUX...

-=HPUX=-
john korterman
Honored Contributor

Re: inode 0 and 1

Hi Shri,

inodes 0 and 1 are taken up by the file system SuperBlock.

regards,
John K.
it would be nice if you always got a second chance
Raj D.
Honored Contributor

Re: inode 0 and 1

Hi shri hunter,

Check this:

Inode 0 can't be used for normal purposes and inode 1 is used to represent the bad blocks in the superblock.

Hence inodes starts from number 2 ,


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "