# 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

```bash
# 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

### Common inode-related Linux Problems:

* 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arkannis.net/os/linux/inodes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
