>_ IzzyLab

Hands-on task

This task is step 15 of the course “Disks, links and free space”

Find the directory that used up the inodes

medium~7 min

The disk reports that it has run out of inodes, even though there's still plenty of space — which means a huge number of small files have multiplied somewhere. Under /root/data there are three subdirectories: app, spool, tmp. Determine which one has the most files (by count, not by size, including nested directories), and write the name of that subdirectory (without the path) to /root/answer.txt.

What you'll practise:
  • inode
  • find
  • wc
  • counting files
  • inode exhaustion

Topic breakdown

A disk can "run out" in two ways: by size and by number of inodes — each file, even an empty one, occupies a single inode, so millions of small files exhaust them before space runs out. So here what matters is not size (du won't help), but the number of files. Walking the directory tree and selecting exactly the files is what find with a type filter allows, and counting the lines of its output is what wc does; comparing the counts across subdirectories, you find the culprit.

What's checked

  1. the culprit directory is found

What it looks like