How to set the Ollama model directory

Ollama stores downloaded model data in a model directory that can become very large. Moving that directory to another disk is useful on workstations and servers where the home or system volume is too small.

The active path is controlled with OLLAMA_MODELS for the server process. Set it before Ollama starts, then verify model pulls and ollama list use the new location.

Move existing models while Ollama is stopped so manifests and blobs stay consistent. Back up the old path before deleting it.

Steps to set the Ollama model directory:

  1. Stop Ollama before moving model data.
    $ sudo systemctl stop ollama

    On macOS or Windows, quit the Ollama app first.
    Related: How to manage the Ollama service

  2. Create the new model directory.
    $ sudo mkdir -p /srv/ollama-models
    $ sudo chown ollama:ollama /srv/ollama-models
  3. Copy existing model data to the new directory.
    $ sudo rsync -a /usr/share/ollama/.ollama/models/ /srv/ollama-models/
  4. Set OLLAMA_MODELS in the service override.
    [Service]
    Environment="OLLAMA_MODELS=/srv/ollama-models"
  5. Restart Ollama and list models from the new path.
    $ sudo systemctl daemon-reload
    $ sudo systemctl restart ollama
    $ ollama list
    NAME           ID              SIZE
    gpt-oss:20b    17052f91a42e    13 GB