Prune

AI models

Ollama 0.40 doubled my models folder: removing the backup copies

Last checked Applies to Ollama 0.40 and later on macOS and Windows, including the 0.40.x point releases 4 min read

Short answer

Since 0.40, Ollama converts each model the first time you run it and keeps the original as a backup, so every model you've used can take twice the space. You can remove only the backups: find the ggml manifest of each model that also has a llamacpp one, and pass its digest to ollama rm. Your models keep working. The only cost is a re-download if you ever go back to an Ollama older than 0.40.

Models on Mac
~/.ollama/models
Models on Windows
C:\Users\<USERNAME>\.ollama\models
Moved it?
OLLAMA_MODELS sets a different models folder
What doubles
Each model you've run since updating: one upgraded copy, one backup
Safe to remove?
The backups, yes. Re-pull needed only if you downgrade below 0.40

Why the folder grew

Ollama 0.40 changed how models are stored. The first time you load an older model, Ollama converts it to run without its patched copy of llama.cpp. So that you can still downgrade, it keeps the original next to the new one, behind a manifest list. Nothing tells you this happened. The models folder just gets bigger.

On a machine with a few large models that adds up fast. One person counted about 20 GB of backups across four models, 13.8 GB of it from gpt-oss:20b alone. You might also see doubled rows in ollama list, or tags that look like llamacpp:4f44980319c2.... Those are the same thing.

Ollama's team has said a later release will remove the old copies once the new format has proven itself. Until then they stay on disk, and the 0.40.2 release notes give a cleanup for people who need the space now.

Remove only the backups

  1. Check how big the folder is

    du -sh ~/.ollama/models
    # PowerShell
    (Get-ChildItem "$env:USERPROFILE\.ollama\models" -Recurse | Measure-Object Length -Sum).Sum / 1GB

    Write the number down so you can compare afterwards.

  2. Run the cleanup with Ollama open

    This is the command from Ollama's 0.40.2 release notes. It asks the local Ollama server for each model, keeps the models that have a llamacpp version, and removes their ggml backup by digest. It needs jq.

    curl -s localhost:11434/api/tags | jq -r '.models[].name' | while read -r m; do
      curl -s localhost:11434/api/show -d "{\"model\":\"$m\"}" | jq -r \
        'select(any(.manifests[]?; .runner == "llamacpp")) | .manifests[] | select(.runner == "ggml") | .digest'
    done | sort -u | xargs -n1 ollama rm
    # PowerShell, no jq needed
    $api = "http://localhost:11434/api"
    $digests = foreach ($m in (Invoke-RestMethod "$api/tags").models.name) {
      $s = Invoke-RestMethod "$api/show" -Method Post -Body (@{model=$m} | ConvertTo-Json)
      if ($s.manifests.runner -contains "llamacpp") {
        ($s.manifests | Where-Object runner -eq "ggml").digest
      }
    }
    $digests | Sort-Object -Unique | ForEach-Object { ollama rm $_ }
  3. Check again

    Run the size check from step 1. Then run ollama list: every model you had is still there, minus the doubled rows.

SafeOnly the old copies go. The upgraded models you actually run are left alone.

CarefulIf you plan to roll back to an Ollama older than 0.40, keep the backups. Without them you'll pull those models again.

Do notDelete files in models/blobs by hand. Blobs are shared between models, and removing the wrong one breaks a model you still use.

Why deleting the llamacpp tag doesn't help

The odd llamacpp:<sha> tag points at the new copy, not the backup. People who removed it found it came back the next time the model loaded, and the space didn't move. Remove the ggml digests as above instead.

Doing it with Prune

Prune now finds these backup copies on Mac and Windows. It asks your running Ollama which models have a backup, shows how much each one would free, and removes only the backups, the same way the command above does. If Ollama isn't running, Prune doesn't list them, so nothing gets guessed.

FAQ

Why does ollama list show the same model twice?

Since 0.40, Ollama keeps the original copy of each model it upgraded. The two rows are the upgraded model and its backup.

Will removing the backups break my models?

No. The command removes only the ggml copies of models that also have a llamacpp copy. The models you run keep working.

Will Ollama remove the backups itself?

Ollama has said a future release will, once the new format has proven itself. Until then they stay on disk unless you remove them.

What happens if I downgrade Ollama after removing them?

Versions older than 0.40 can't run the upgraded copies, so you'd pull those models again.