Pcornel
Linux · Filesystem

/var

Cheat sheet · https://pcornel.dk/topic.php?topic=2673

Back to the Topic

Answer

/var holds variable data that changes while the system runs: logs (/var/log), caches, spools, package databases and service data (/var/lib).

Remember

/var growth is the most common cause of full disks: check du -xh /var | sort -h | tail. Databases and container images live under /var/lib — consider a separate filesystem.

First checks

  • ls -ld <path> — owner, permissions and type
  • stat <path> — inode, links, size and timestamps
  • df -h <path> — filesystem and free space
  • findmnt <path> — which mount the path is on

Commands

docker system prune
journalctl --vacuum-size
docker system df

Verify in this order

/var mounted (or virtual) → correct owner and permissions → enough space → services read and write as intended

Where it usually breaks

First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2673

Confirmation

Confirm action

Continue?