LFCS Operation of Running Systems Practice Question
A server runs out of inodes. The administrator needs to find which filesystem is exhausted and which directory has the most files. Which command sequence best accomplishes this?
⚠ Common exam trap
Watch out — candidates often confuse inode exhaustion with disk space exhaustion and choose `df -h` and `du -sh` (Option D), or they use a recursive file count without restricting to a single filesystem (Option A), failing to isolate the problematic filesystem and directory.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
df -i; find / -xdev -type f -printf '%h\0' | sort -z | uniq -c -z | sort -rn | head
`df -i` first checks inode usage across all mounted filesystems to identify which one is exhausted. Then the `find / -xdev -type f -printf '%h\0' | sort -z | uniq -c -z | sort -rn | head` command counts files per directory on the root filesystem only (due to `-xdev`), using null-delimited output to handle special characters in filenames, and sorts to show the directory with the most files. This directly addresses both parts of the problem: identifying the exhausted filesystem and the directory with the most files.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
df -i; find / -type f | wc -l
Why it's wrong here
find / -type f | wc -l gives one total file count for the whole tree, not a per-directory breakdown, so it cannot locate the offending directory. It is tempting because it does confirm inode pressure, and would suffice if only the total number of files were needed.
- ✓
df -i; find / -xdev -type f -printf '%h\0' | sort -z | uniq -c -z | sort -rn | head
Why this is correct
`df -i` reports inode usage per filesystem, isolating the exhausted mount. The `find` pipeline then counts files per directory: `-xdev` prevents crossing into other filesystems, `-printf '%h\0'` emits each file's directory NUL-separated, and `sort -z | uniq -c -z | sort -rn` ranks directories by file count.
- ✗
df -i; du --inodes /
Why it's wrong here
du --inodes reports inode counts per directory but not per mounted filesystem, so it cannot identify which filesystem is exhausted. It is tempting because du is the natural tool for ranking directory sizes, and it would be correct when hunting for space consumption rather than inode exhaustion.
- ✗
df -h; du -sh /
Why it's wrong here
df -h reports block usage, not inode usage, and du -sh totals bytes rather than file counts, so neither command addresses inode exhaustion. It is tempting because this pairing is the standard first response to a full disk, which is the correct diagnosis when blocks, not inodes, are depleted.
Go deeper
Related to this question
About these practice questions
This LFCS question is part of Courseiva's 406-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.