ollama/server/internal
Blake Mizerany 7a01ad7614
server/internal/registry: reintroduce pruning on model deletion (#9489)
This reintroduces aggressive pruning on model deletion as a temporary
measure until a more controlled garbage collection (GC) mechanism is
implemented.

Issues with the current approach:

1. Users may accidentally delete a model (`ollama rm llama3.3` instead
   of `ollama rm llama3.2`), requiring a full re-download unless another
   model references the same blobs.

2. Users may assume a deleted model is still referenced elsewhere, but
   due to prior updates or deletions, the references no longer exist,
   leading to unnecessary re-downloads.

Soon, we should implement a structured GC mechanism to retain
unreferenced blobs for a configurable period before removal, which will
run on "ollama rm" and other commands we deem appropriate.

Users that want to immediately remove unreferenced blobs can use a new
prune command that will allow them to specify the age and class of blobs
to remove.

Example usage:

    # Run basic blob GC
    $ ollama prune

    # Remove unreferenced blobs older than 7 days
    $ ollama prune --age 7d

    # Remove all blobs, referenced or not, older than 7 days (and their manifests?)
    $ ollama prune --age 7d --all

    # Remove all unreferenced blobs immediately
    $ ollama prune --age 0 --all

    # Remove all blobs
    $ ollama prune --age 0 --all

This should provide a safer and more predictable cleanup process.
2025-03-03 19:11:16 -08:00
..
cache/blob server/internal: replace model delete API with new registry handler. (#9347) 2025-02-27 12:04:53 -08:00
chunks server/internal: copy bmizerany/ollama-go to internal package (#9294) 2025-02-24 22:39:44 -08:00
client/ollama server/internal/client/ollama: hold DiskCache on Registry (#9463) 2025-03-02 20:55:44 -08:00
cmd server/internal/client/ollama: hold DiskCache on Registry (#9463) 2025-03-02 20:55:44 -08:00
internal server/.../backoff,syncs: don't break builds without synctest (#9484) 2025-03-03 16:45:40 -08:00
manifest server/internal: copy bmizerany/ollama-go to internal package (#9294) 2025-02-24 22:39:44 -08:00
registry server/internal/registry: reintroduce pruning on model deletion (#9489) 2025-03-03 19:11:16 -08:00
testutil server/internal: replace model delete API with new registry handler. (#9347) 2025-02-27 12:04:53 -08:00