[GH-ISSUE #2097] Overwriting an existing model from a modelfile leaves old blob not deleted #26963

Closed
opened 2026-04-22 03:45:41 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @hyjwei on GitHub (Jan 19, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2097

Originally assigned to: @mxyng on GitHub.

Problem

When I import a GGUF model into ollama, I create a modelfile with "FROM" line and then run ollama create, and a blob is created in model directory.

Then I decide to import another GGUF model (different quant parameters), I modify the "FROM" line and the run ollama create again. A new blob is created, but the old blob is still in model directory.

If I run ollama rm to remove the model, only the second blob is deleted but the old one is still there. I don't know how to properly delete that old blob using ollama command line and I have to delete the file manually.

Expected behavior

When I overwrite a existing model using ollama create command, the old blobs should be removed.

Or, there should be an option, like fsck, to purge the obsolete blobs from model directory.

Regards,

Originally created by @hyjwei on GitHub (Jan 19, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2097 Originally assigned to: @mxyng on GitHub. ### Problem ### When I import a GGUF model into ollama, I create a modelfile with "FROM" line and then run `ollama create`, and a blob is created in model directory. Then I decide to import another GGUF model (different quant parameters), I modify the "FROM" line and the run `ollama create` again. A new blob is created, but the old blob is still in model directory. If I run `ollama rm` to remove the model, only the second blob is deleted but the old one is still there. I don't know how to properly delete that old blob using ollama command line and I have to delete the file manually. ### Expected behavior ### When I overwrite a existing model using `ollama create` command, the old blobs should be removed. Or, there should be an option, like `fsck`, to purge the obsolete blobs from model directory. Regards,
Author
Owner

@mxyng commented on GitHub (Jan 19, 2024):

This is somewhat intentional. When creating a model, ollama doesn't check if it's overwriting an existing model. Therefore replacing an ollama model with a different binary model will seem as two separate, unrelated creates

Or, there should be an option, like fsck, to purge the obsolete blobs from model directory.

A full directory scan happens when ollama server starts. It will detect any dangling blobs and remove them

<!-- gh-comment-id:1901264440 --> @mxyng commented on GitHub (Jan 19, 2024): This is somewhat intentional. When creating a model, ollama doesn't check if it's overwriting an existing model. Therefore replacing an ollama model with a different binary model will seem as two separate, unrelated creates > Or, there should be an option, like fsck, to purge the obsolete blobs from model directory. A full directory scan happens when ollama server starts. It will detect any dangling blobs and remove them
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#26963