inodes

In linux files are simple structures that do not contain any metadata:

A file is composed of:

  • a file name

  • an inode number

Directories are Filename-inode number Pairs Note: you can think of Diretories as a table of inode parings

# to view inode-pairs
ls -i

What does an inode contain?

  • The size of the file

  • The actual physical location on the hard disk where it is located

  • Permissions

  • Owner, Group owner

  • Access time / Modification time, depending on which is active

  • Also contains the reference count (basically how many hardlinks point to this particular inode)

What happens when you use the ls -l command?

ls -l --> needs more info --> stat --> looks up the inode --> retuns to shell processor --> output

This runs in a loop for each file in the directory

  • No space but after running df -h shows space

This can be caused by inode exhaustion

Use: df -hi to check, if this is at 100% there are no inodes left

Causes:

  • This can happen on a system where you have a lot of small files that use up all the inodes**

  • Can also be caused by systems with a lot of caches

How inodes are created in Linux:

Classic Filesystems create all the space that they ever going to have when the filesystem is created

Such as: EXT

Note: Unless you pass an extra flag during installation to overwrite that

Using a modern filesystem like ZFS, inodes are created on demand

Last updated