JuniorLinux

A server reports the disk is full. Walk me through finding what is using the space.

What they are really testing: Whether you debug methodically and know the classic traps (deleted-but-open files, inode exhaustion), not just "delete some logs".

A real interview question

A server reports the disk is full. Walk me through finding what is using the space.

What most people say

drag me

I would delete old log files to free up space.

It might work, but it skips diagnosis: which filesystem, what is actually large, and the two classic traps (deleted-open files and inode exhaustion) where deleting logs does nothing. No prevention either.

The follow-ups they ask next

  • du and df disagree on usage. What is happening?

    Almost always a deleted-but-still-open file: the directory entry is gone (du does not see it) but the space is held until the process closes the descriptor. lsof +L1 or lsof | grep deleted; restart the holder.

  • Disk space is free but you still get "No space left on device". Why?

    Inode exhaustion, df -i. Too many small files used up all inodes. Delete unneeded small files or recreate the filesystem with more inodes.

What the interviewer is listening for

  • Uses df then du to localize
  • Knows the deleted-open-file trap
  • Checks inodes (df -i)
  • Adds prevention

What sinks the answer

  • Just "delete logs" with no diagnosis
  • Unaware of deleted-open files
  • Never considers inodes

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

I start with [df -h to find the full mount], then [du to rank the biggest dirs/files]. If df and du disagree it is [a deleted-but-open file, find with lsof | grep deleted and restart the process]. I also check [df -i for inodes]. Then I fix the cause with [log rotation + alerting].

Keep going with linux

All 336 cloud engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free