Skip to content
ENExplore Calculators

YUM DNF Cache Calculator

Calculate disk space consumed by the YUM or DNF package manager metadata and RPM cache.

About YUM DNF Cache Calculator

DNF/yum caches two distinct things under /var/cache/dnf (or /var/cache/yum on older systems): repository metadata (the compressed package lists, dependency info and checksums each enabled repo publishes, needed to resolve `dnf install`/`search` without re-downloading metadata every time) and actual downloaded RPM package files (kept after install unless `keepcache=0`, useful for reinstalling or rolling back without re-downloading). `dnf clean all` removes both, recovering their combined size, at the cost of the next operation needing to re-download metadata (and packages, if reinstalled).

Formula

Cache size

cache_size = repos × packages_per_repo × metadata_per_package + cached_rpm_count × avg_rpm_size

Worked example

With the default values below, YUM DNF Cache Calculator returns Total DNF/Yum Cache Size of 425.47 MB. Change any input above and every figure here is recalculated in your browser.

Inputs used

Enabled Repositoriesminimum 1
6
Avg Packages Listed per Repominimum 1
15,000
Metadata Overhead per Package (KB)minimum 0.01
1.2
Downloaded RPMs Currently Cachedminimum 0
40
Avg Cached RPM Size (MB)minimum 0.1
8

Results

Total DNF/Yum Cache Size
425.47 MB
Space Recovered by `dnf clean all`
425.47 MB
Repository Metadata Cache
105.47 MB
Downloaded Package (RPM) Cache
320 MB

Step by step

  1. 1Values used
  2. 2Cache size
  3. 3Total DNF/Yum Cache Size= 425.47 MB
  4. 4Space Recovered by `dnf clean all`= 425.47 MB
  5. 5Repository Metadata Cache= 105.47 MB
  6. 6Downloaded Package (RPM) Cache= 320 MB

Assumptions and limits

  • The result is derived only from the 5 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax or compounding frequency into account.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

What's the difference between `dnf clean metadata` and `dnf clean all`?

`dnf clean metadata` removes only the cached repository metadata (forcing a fresh metadata download on the next operation), while `dnf clean all` also removes cached downloaded RPM packages — use `metadata` alone if you just want fresh package lists without losing cached RPMs for possible reinstalls.

Where exactly does DNF store its cache?

Under /var/cache/dnf/, with a separate subdirectory per enabled repository containing both the repo's metadata (repodata/) and any downloaded packages/ subdirectory — `du -sh /var/cache/dnf/*` breaks down usage per repo.

Does clearing the DNF cache affect already-installed packages?

No — clearing the cache only removes downloaded metadata and RPM files used during install/update operations; it has no effect on packages already installed on the system, since those live under the RPM database and filesystem, not the cache directory.

YUM DNF Cache Calculator | Calcrivo