ollama - 💡(How to fix) Fix Need a way to remove and delete older models [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#14911Fetched 2026-04-08 00:53:07
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
commented ×2closed ×1labeled ×1
RAW_BUFFERClick to expand / collapse

I have old models that I downloaded that are large that I no longer use. It would be good to have an easy way to delete these old models off of my hard drive in Ollama. If I go delete them manually, will Ollama get screwed up? How is Ollama tracking what models I have and how would that be updated?

extent analysis

Fix Plan

To safely delete old models in Ollama, we will implement a model removal feature.

Steps to Remove Old Models

  • Stop the Ollama application to prevent any potential conflicts.
  • Identify the models to be deleted and their corresponding files and directories.
  • Remove the model files and directories manually or through a script.
  • Update Ollama's model tracking mechanism, which is likely a database or configuration file.

Example Code

import os
import json

# Load Ollama's model configuration file
with open('ollama_config.json') as f:
    config = json.load(f)

# Identify models to delete
models_to_delete = ['model1', 'model2']

# Remove model files and directories
for model in models_to_delete:
    model_dir = os.path.join('models', model)
    if os.path.exists(model_dir):
        import shutil
        shutil.rmtree(model_dir)

# Update Ollama's model configuration file
for model in models_to_delete:
    if model in config['models']:
        config['models'].remove(model)

# Save the updated configuration file
with open('ollama_config.json', 'w') as f:
    json.dump(config, f)

Verification

After running the script, verify that:

  • The old models are no longer listed in Ollama's model configuration file.
  • The corresponding model files and directories have been removed.
  • Ollama application starts without any errors related to the deleted models.

Extra Tips

  • Make sure to backup Ollama's configuration file and model files before making any changes.
  • Consider implementing a user interface in Ollama to simplify the model removal process.
  • Always test the changes in a non-production environment before applying them to the production setup.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING