Guide

How to check the disk space of, Linux server

Quickly display the use file systems on Linux.

⌚ About 2 min read
View my favorites
Linux Beginner 3 min

Quickly display the use file systems on Linux.

Avant de commencer : adaptez toujours les commandes et manipulations à votre environnement. Sur un système de production, prévoyez une backup ou un retour arrière lorsque l’action peut modifier la configuration.

Étapes à suivre

  1. 1

    Open a terminal.

    Connect locally or via SSH.

  2. 2

    Show volumes

    Use df -h.

  3. 3

    Locate almost full partitions

    Look at the column Use%.

  4. 4

    Identify large directories if necessary

    Use in a way that is targeted at the volume concerned.

Commands utiles

df -h
of -xh --max- 2701 /var 2>/dev/null, sort -h

À retenir

  • N, do not perform search of the complete on a loaded server without considering the,I/O impact.
  • Deleted but still open files can continue to occupy space.
Technical deep dive

Linux storage: distinguish blocks, inodes and deleted-but-open files

Technical checkpoints

  • df measures filesystem space while du measures visible files; a large gap can come from deleted files still held open.
  • df -i detects inode exhaustion, which can prevent file creation even with GBs free.
  • A filesystem remounted read-only may be kernel protection after I/O/filesystem errors; remounting rw without understanding the cause is risky.

Storage triage

Compare blocks, inodes, large directories and deleted files still open.

df -hT
df -i
du -xhd1 /var | sort -h
lsof +L1

Topic-specific pitfalls

  • Running rm under /var/lib or Docker without identifying data ownership can break services.
  • fsck should not be run on a filesystem mounted read-write except in specific documented cases.

How to validate

  • The cause of consumption or read-only transition is identified in logs/kernel.
  • After remediation, blocks and inodes have headroom and no new I/O errors appear.
♡ 0