Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

/var

Direct answer

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

When to use this

Use it when logs or service data fill the disk, or to find where a service stores its data.

First 30 seconds

1. ls -ld /var and findmnt /var — present and mounted where expected?

2. df -h /var — space left? df -i /var — inodes left?

3. Find large or unexpected content: du -xh --max-depth=1 /var | sort -h | tail.

4. Permissions and owner as the FHS and services expect?

5. Fix space, permissions or mount, then retest the service.

Operational verification

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

Evidence · next step

For Filesystem → /var, continue with the first unproven Topic check: Map the affected /var subtree to owning package/service and classify state versus cache/log/spool. If that boundary is healthy, advance to the adjacent check: Check actual mount, block capacity, inode capacity and open-deleted-file behavior. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Key commandjournalctl --disk-usage
Scope / prerequisiteUse it when logs or service data fill the disk, or to find where a service stores its data.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

service/workload → variable-state write → /var subtree ownership → filesystem block/inode allocation → rotation/retention/open-file lifecycle → service result

Healthy evidence: the responsible service, data class, mount/capacity and retention/open-file lifecycle are explicit and service behavior is normal with adequate headroom.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Map the affected /var subtree to owning package/service and classify state versus cache/log/spool.

  • Check actual mount, block capacity, inode capacity and open-deleted-file behavior.
  • Correlate growth with producer workload, retention/rotation and failure symptoms.
  • After cleanup/repair, verify both filesystem headroom and the responsible service/application workload.

Verification chain. service/workload → variable-state write → /var subtree ownership → filesystem block/inode allocation → rotation/retention/open-file lifecycle → service result

Step 3 Commands Verify boundary
du -sh /var/* | sort -h
journalctl --disk-usage
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: all /var data is treated as disposable logs, root filesystem capacity is substituted for /var capacity, or files are deleted while open handles still retain space.

/var usage shows variable-data allocation at that path, not safe deletability, root-filesystem capacity or application consistency.

Step 5 Common mistakes Narrow the fault
  • /var filling from logs, caches or containers.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

/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.

Key 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
ReferenceWhat it is1 section · depth on demand

Core model

Identify the exact /var subtree owner and mount/capacity/inode boundary, distinguish expendable cache from authoritative state, then correlate growth or corruption with the producing service. Do not delete content based solely on path location; /var/lib and similar directories often contain critical application state.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

/var usage shows variable-data allocation at that path, not safe deletability, root-filesystem capacity or application consistency.

In depth

/var: logs, state, caches and spools

/var holds data that changes while the system runs. The hier(7) manual page describes its main parts:

  • /var/cache, data cached for programs;
  • /var/lib, variable state information for programs;
  • /var/log, log files;
  • /var/spool, queued files for various programs;
  • /var/tmp, temporary files kept longer than in /tmp.

Because /var grows, it's the most common reason for a full root file system.

What can be deleted, and what can't

DirectoryContentSafe to delete?
/var/cache/apt, /var/cache/dnfDownloaded packagesYes: apt clean, dnf clean all
/var/logLogsOld rotated files; use logrotate and journald limits
/var/lib/<program>Databases, application stateNo; this is data
/var/lib/docker, /var/lib/containersImages and containersOnly through the tool (docker system prune)
/var/spool/mail, /var/spool/cronMail, crontabsNo
/var/crashCrash dumpsYes, after analysis

Separating /var

SeparateReason
/varGrowth can't fill root
/var/logA log storm can't stop databases
/var/lib/<db>Its own size, performance and backups
/var/lib/dockerContainer images can be very large

Investigating growth

host$ sudo du -xh --max-depth=2 /var 2>/dev/null | sort -h | tail -6
1.1G    /var/cache/apt
2.4G    /var/log/journal
3.9G    /var/log
9.8G    /var/lib/docker
12G     /var/lib
18G     /var
host$ journalctl --disk-usage
Archived and active journals take up 2.4G in the file system.
host$ sudo journalctl --vacuum-size=500M
host$ sudo apt clean
host$ docker system df
host$ sudo find /var/log -name '*.gz' -mtime +60 -size +50M -ls | head

Reading the example

Container data in /var/lib/docker and the journal are the largest consumers here. journalctl --vacuum-size trims the journal immediately. To keep it trimmed, set SystemMaxUse= in journald.conf. For containers, docker system df shows what can be reclaimed before you prune anything.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

/var is part of Filesystem → /var. /var contains variable persistent data such as logs, spool/queue data, caches, package/application state and databases, with subdirectory purpose depending on the service; growth under /var can impair system services even when another filesystem has free space.

Topic-specific state model. /var contains variable persistent data such as logs, spool/queue data, caches, package/application state and databases, with subdirectory purpose depending on the service; growth under /var can impair system services even when another filesystem has free space.

Interpretation rule. - /var ≠ only logs; it can contain databases, queues, package state and other authoritative data.

  • Free space on / ≠ free space on /var when /var is a separate mount.
  • Cache-looking path ≠ safe to delete without owning-application semantics.
  • Log rotation/deletion ≠ space immediately returns if a process still holds an unlinked file open.

Quick reference

/var holds variable data:

PathContent
/var/logLogs (and /var/log/journal)
/var/libPersistent state: databases, Docker, package DBs
/var/cacheRegenerable caches (package downloads)
/var/spoolQueues (mail, cron, print)
/var/tmpTemp files preserved across reboots
du -xh --max-depth=2 /var | sort -h | tail -15

Give /var (or at least /var/log and /var/lib/<busy app>) its own filesystem so runaway logs or container images cannot fill /.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. /var usage shows variable-data allocation at that path, not safe deletability, root-filesystem capacity or application consistency.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. /var owns variable-data hierarchy semantics. Logging, Package Management, databases, queues, Filesystems & Mounting and Storage own their specific state/lifecycle behavior.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Filesystem → /var. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
linux /varvar directory linuxlinux variable datavar full linux
Embedded reference data

Quick lookup tables

/var operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for /var.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective state/var contains variable persistent data such as logs, spool/queue data, caches, package/application state and databases, with subdirectory purpose depending on the service; growth under /var can impair system services even when another filesystem has free space.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin process/container mount namespace → resolve the exact path from / and record every mount crossing → identify final dentry + filesystem/device + inode + file type → capture ownership/mode/ACL and capacity where relevant → map pseudo/device/runtime objects to the live kernel/process endpoint → verify the original consumer read/write/execute/service result.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainservice/workload → variable-state write → /var subtree ownership → filesystem block/inode allocation → rotation/retention/open-file lifecycle → service resultTrace requested/configured state through effective state to the observed workload result.
Failure boundary/var usage proves variable-data allocation at that path, not safe deletability, root-filesystem capacity or application consistency.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated namespace, path and object evidence can establish this Linux Filesystem proof path: service/workload → variable-state write → /var subtree ownership → filesystem block/inode allocation → rotation/retention/open-file lifecycle → service resultUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured namespace, mount, inode/object, authorization, backing-resource or consumer scope. /var usage proves variable-data allocation at that path, not safe deletability, root-filesystem capacity or application consistency.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: preserve the same process mount namespace, resolve the path and mount crossings, identify the exact object/inode or live pseudo/device endpoint, inspect effective access/capacity, then repeat the original consumer operation before changing unrelated filesystem state.Continue to the next unresolved boundary while preserving the original test condition.

/var · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundary/var
Topic pathFilesystem → /var
Runtime state/var contains variable persistent data such as logs, spool/queue data, caches, package/application state and databases, with subdirectory purpose depending on the service; growth under /var can impair system services even when another filesystem has free space.
Fast checks- Map the affected /var subtree to owning package/service and classify state versus cache/log/spool. - Check actual mount, block capacity, inode capacity and open-deleted-file behavior. - Correlate growth with producer workload, retention/rotation and failure symptoms. - After cleanup/repair, verify both filesystem headroom and the owning service/application workload.
Verification chainservice/workload → variable-state write → /var subtree ownership → filesystem block/inode allocation → rotation/retention/open-file lifecycle → service result Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundary/var usage proves variable-data allocation at that path, not safe deletability, root-filesystem capacity or application consistency. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?