Search code examples
ubuntufilesystemsinode

how many inodes need to check for go to given file


in ubuntu system use inode how many i nodes need to store this file?

/a/b/c/d.jpg 

Is it 4 or 5 (I mean are the ROOT directory is in an inode?)

I cannot clear this .. Please some one help.


Solution

  • For the file itself, you need one (1) inode.

    For the directory path, you'll have the root inode (1) and one inode per subdirectory (3).

    The filesystem itself will have one (1) additional inode used for the list of defective blocks.

    So, at least for ext4, 6 is the minimum necessary inodes for that file to exist. Your teacher may also accept 5, or 1 if it's a trick question (the file only needs one inode).