skip to content

After a week of `ollama pull` fills a laptop's disk, how is Ollama's OLLAMA_MODELS store laid out, and how do you reclaim or move it?

level: middleimportance: should knowfreq 12%

answer

  1. two folders, not one file per model
  2. content-addressed sha256 blobs
  3. copies share blobs
  4. rm frees only unreferenced blobs
  5. OLLAMA_MODELS and the ollama user

basics

~10 s

OLLAMA_MODELS holds manifests/ (one small JSON per name:tag) and blobs/ (sha256-named layers shared between manifests). Free space with ollama rm, which deletes only blobs no other manifest uses; move the store by setting OLLAMA_MODELS.

solid answer

~40 s

The store, `~/.ollama/models` on macOS and `/usr/share/ollama/.ollama/models` for the Linux service unless `OLLAMA_MODELS` says otherwise, has two parts: `manifests/<host>/<namespace>/<model>/<tag>`, a small JSON file per name, and `blobs/sha256-<hex>`, the layers themselves. A blob is stored once however many manifests list it, so `ollama cp` costs no disk, and `ollama ls` overstates usage because its `SIZE` sums every layer of each entry. `ollama rm` deletes the manifest and then only the blobs no other manifest still references, so removing a copy frees nothing while removing each distinct quant variant frees its weights. Re-pulling a tag drops the layers it stopped using, and on startup the server prunes unreferenced blobs unless `OLLAMA_NOPRUNE` is set. To move the store, set `OLLAMA_MODELS` for the server, give the Linux `ollama` user ownership, and restart.

code

bash · 15 lines
bash
ollama ls
ollama rm orca-mini:3b-q8_0 llama3:70b
du -sh ~/.ollama/models/blobs

# Linux service: point the server at a bigger disk
sudo systemctl stop ollama
sudo mkdir -p /data/ollama-models
sudo cp -a /usr/share/ollama/.ollama/models/. /data/ollama-models/
sudo chown -R ollama:ollama /data/ollama-models
sudo systemctl edit ollama.service
#   [Service]
#   Environment="OLLAMA_MODELS=/data/ollama-models"
sudo systemctl daemon-reload
sudo systemctl restart ollama
ollama ls

go deeper

for a junior

Recall the default store path on your platform, that ollama ls lists local models and ollama rm removes them, and that OLLAMA_MODELS changes the location.

for a middle

Explain manifests against content-addressed blobs, why ollama cp is free, why the SIZE column double-counts shared layers, and what ollama rm actually deletes.

for a senior

Diagnose the full disk from blobs rather than ollama ls, move the store for the service user rather than your shell, and know when startup pruning and OLLAMA_NOPRUNE apply.

for a principal

Decide whether a shared box should cap the variants people may pull, pre-seed one store for every machine, or give each user a quota, weighing disk against convenience.

## Where the store lives Ollama keeps every local model in one directory, the **models directory**. Its default depends on how Ollama runs: | Platform | Default models directory | |---|---| | macOS | `~/.ollama/models` | | Linux (installed as the `ollama` systemd service) | `/usr/share/ollama/.ollama/models` | | Windows | `C:\Users\%username%\.ollama\models` | The `OLLAMA_MODELS` environment variable overrides it. It is read by the **server**, not by the `ollama` CLI you type into, so it has to be set where the server gets its environment: `launchctl setenv` for the macOS app, a `systemctl edit ollama.service` override for the Linux service, the user or system environment on Windows. ## Two folders: manifests and blobs Inside the models directory there are two trees: - `manifests/` holds one small JSON file per model name, at `manifests/<host>/<namespace>/<model>/<tag>`, for example `manifests/registry.ollama.ai/library/llama3/70b`. A manifest lists the model's **layers** by sha256 digest: weights, template, parameters, licence, config. - `blobs/` holds the layers themselves as files named `sha256-<64 hex>`. The manifest spells a digest with a colon (`sha256:…`) and the file name uses a hyphen. The store is **content-addressed**: a layer is stored once, however many manifests reference it. That one property explains most of the disk-usage surprises: - `ollama cp llama3:70b team-llama` writes a second manifest file and nothing else, so it costs almost no disk. - A model built on top of a pulled one (a custom system prompt over the same weights) shares the big weights blob with its base. - Different **size or quant variants** (`orca-mini:3b-q8_0` beside another quant of it) have different weights blobs, so each one costs its full size. A week of trying variants is where the disk usually goes. ## Reading what `ollama ls` tells you `ollama ls` prints `NAME`, `ID`, `SIZE` and `MODIFIED`. `SIZE` is the sum of the layer sizes listed in that one manifest, so a blob shared by three names is counted three times. Adding up the column overstates the disk in use; measuring `blobs/` directly gives the real figure. Cloud-hosted models show `-` because no weights are stored for them. ## Reclaiming space safely 1. List what is there with `ollama ls` and decide which names to drop. 2. Remove them with `ollama rm`, which accepts several names at once. It deletes the manifest, then deletes each of its blobs that **no other manifest still references**. 3. Check `blobs/` again. If a removed name was only a copy or shared its weights with a model you kept, the space is still in use, and that is correct. Other cleanup happens on its own: - Re-pulling a tag whose manifest changed removes the layers the old manifest used and nothing else references. - At startup the server **prunes** blobs no manifest references. It skips blobs modified within the last hour, skips the prune entirely if it finds a corrupt manifest, and also clears invalid leftovers such as partial downloads. Setting `OLLAMA_NOPRUNE` disables pruning at startup and after pulls. - Do not delete files in `blobs/` by hand: a manifest that points at a missing blob is a broken model, and only `ollama rm` or a re-pull puts the store back in a consistent state. ## Moving the store to a bigger disk 1. Stop the server. 2. Copy both `manifests/` and `blobs/` to the new location; one without the other is useless. 3. Set `OLLAMA_MODELS` to that directory for the server process. 4. On Linux with the standard installer, give the service account access: `sudo chown -R ollama:ollama <directory>`. 5. Restart the server and confirm `ollama ls` lists the same names and IDs. The usual mistake is exporting `OLLAMA_MODELS` in your own shell while the service keeps running with its old environment: the CLI talks to that server, which still reads the old directory. ## Keeping it from filling up again - Write the few tags you actually use into scripts and app config, so provisioning does not pull a new variant on every machine. - After comparing variants, `ollama rm` the ones you rejected; only the last name referencing a weights blob frees it. - Expect a restart to free more space than `ollama rm` did when blobs were orphaned some other way: startup pruning removes them once they are more than an hour old. - Cloud-hosted models take no space in `blobs/`, but they also mean inference leaves the machine, which is a separate decision from disk. - Watch `blobs/` with an ordinary disk-usage tool rather than the `SIZE` column, which counts shared layers once per name.

  • You ran `ollama rm` on a model and `blobs/` did not shrink. Is the store broken?
    Usually not. `ollama rm` deletes the manifest and then only the blobs no other manifest references. If the name was an `ollama cp` copy, or a custom model built over weights another name still uses, those blobs stay because they are still in use. Remove the last name that references the weights and they go.
  • You set `OLLAMA_MODELS` in your shell and `ollama ls` still shows the old models. Why?
    The variable is read by the server process, and the CLI only talks to that server over HTTP. A server already running as the macOS app or the Linux `ollama` service keeps its own environment. Set the variable where the server gets it (`launchctl setenv`, a systemd override), make sure the `ollama` user can write the directory on Linux, and restart.

  • Each ollama cp duplicates the model's weights on disk.
  • Adding up the SIZE column of ollama ls gives the disk the store uses.
  • ollama rm always frees the model's full size immediately.
  • Deleting files in the blobs folder by hand is a safe way to free space.
  • Exporting OLLAMA_MODELS in your shell moves the store for the running service.