NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content
Middle2 views

How would you diagnose a situation where disk space is running out?

Practice

Asked at

AI answer

First, I’ll check exactly where the space is running out and how urgent the situation is: df -h shows filesystem usage, while df -i shows inode usage. Then I’ll find large directories, for example du -xhd1 /var 2>/dev/null | sort -h, and check logs, temporary files, container images, and other likely sources of growth. If space is not freed after deleting files, I’ll check for processes that are holding deleted files open (lsof +L1). I’ll free space safely: first, I’ll determine the files’ purpose and owner, then use rotation or cleanup according to the service’s rules. After that, I’ll check the metrics, configure alerts, and address the cause of the growth.