booklet

Ollama Beyond Defaults: Custom Model Paths on Windows and WSL

devinfo.dev — May 27, 2026

devinfo.dev:2026.0010

The Problem

Ollama stores models at a default location. On Windows: C:\Users\%USERNAME%\.ollama\models. On Linux/WSL: ~/.ollama/models.

This works until it does not. Your C: drive fills up. You want models on a faster SSD. You run Ollama in WSL but downloaded models on Windows. You have a shared drive across machines.

The official docs mention OLLAMA_MODELS. They do not mention the dozen ways it can fail silently.

Default Paths

| Platform | Default Path |

|----------|-------------|

| Windows | C:\Users\%USERNAME%\.ollama\models |

| Linux / WSL2 | ~/.ollama/models |

| macOS | ~/.ollama/models |

| Docker | /root/.ollama/models |

Ollama reads and writes all model data here: manifests, blobs, and metadata.

Windows Native: Changing the Model Path

Method 1: Environment Variable (Recommended)

Set OLLAMA_MODELS as a user environment variable.

Via Settings:

1. Open Settings > System > About > Advanced system settings

2. Click Environment Variables

3. Under User variables, click New

4. Variable name: OLLAMA_MODELS

5. Variable value: D:\OllamaModels (or your preferred path)

6. Click OK

7. Restart Ollama completely (quit from system tray, relaunch)

Via PowerShell:

``

[System.Environment]::SetEnvironmentVariable("OLLAMA_MODELS", "D:\OllamaModels", "User")

`

Restart Ollama after setting.

Method 2: Move Existing Models

If you already have models downloaded and want to move them:

1. Stop Ollama (quit from system tray)

2. Copy the entire .ollama\models folder to the new location

3. Set OLLAMA_MODELS to the new path

4. Restart Ollama

5. Run ollama list to verify models appear

Do not delete the old folder until you confirm ollama list shows your models.

Verification

`

PowerShell - confirm variable is set

$env:OLLAMA_MODELS

Should output your custom path

Then verify Ollama sees models:

ollama list

`

If ollama list returns empty, Ollama is not reading from your custom path. See Troubleshooting below.

Known Issue: Variable Not Respected

Some Windows versions (notably with Ollama 0.17.x) silently ignore OLLAMA_MODELS. The environment variable is set, but Ollama continues reading from the default path.

Workaround: Manually edit the SQLite database:

1. Navigate to %USERPROFILE%\AppData\Local\Ollama\

2. Open db.sqlite with any SQLite tool (e.g., DB Browser for SQLite)

3. Find the settings table

4. Update the model path entry to your desired location

5. Restart Ollama

This is ugly but reliable when the environment variable fails.

WSL2 Ubuntu: Changing the Model Path

On WSL2, Ollama can run two ways: manually via ollama serve, or as a systemd service. The configuration differs.

For Manual Runs

Add to ~/.bashrc or ~/.zshrc:

`

export OLLAMA_MODELS=/home/username/models

`

Then:

`

source ~/.bashrc

ollama serve

`

Ollama will read from /home/username/models.

For systemd Service

The service runs as the ollama user, which does not read your .bashrc. You need a service override:

`

sudo mkdir -p /etc/systemd/system/ollama.service.d

sudo nano /etc/systemd/system/ollama.service.d/override.conf

`

Add:

`

[Service]

Environment="OLLAMA_MODELS=/data/ollama/models"

`

Then:

`

sudo mkdir -p /data/ollama/models

sudo chown ollama:ollama /data/ollama/models

sudo systemctl daemon-reload

sudo systemctl restart ollama

`

Critical: the ollama user must own the custom directory. Without this, Ollama starts but cannot read or write models.

Verification

`

Check the service environment

sudo systemctl show ollama --property=Environment

Confirm models are visible

ollama list

`

Cross-Boundary: Windows and WSL Sharing Models

This is where most people get stuck. You have models on Windows. You want WSL Ollama to use them. Or vice versa.

The Performance Trap

WSL2 accesses the Windows filesystem via /mnt/c/. This bridge uses the 9P protocol. It is dramatically slower than native ext4 access inside WSL.

Do not point OLLAMA_MODELS to /mnt/c/Users/.../models in WSL. Model loading will be 3-10x slower. Large models (13B+) may timeout during load.

Recommended Approach: Separate Copies

Keep models in their native filesystem:

  • Windows Ollama reads from D:\OllamaModels
  • WSL Ollama reads from /home/user/models

Yes, this duplicates storage. But inference speed depends on I/O speed, and the /mnt/c bridge is the bottleneck.

Alternative: Symlink from WSL to Windows (Use with Caution)

If you accept the performance penalty and want to avoid duplication:

`

In WSL:

ln -s /mnt/c/Users/YourName/.ollama/models ~/.ollama/models

`

Ollama will follow the symlink. Models will load slowly. For small models (7B Q4), the penalty is tolerable. For 13B+ or unquantized models, it is not.

Alternative: Windows Reads from WSL

WSL2 filesystems are accessible from Windows at \\wsl$\Ubuntu\home\username\...

You can set OLLAMA_MODELS on Windows to:

`

\\wsl$\Ubuntu\home\username\models

`

This is a network path. It works but has the same 9P performance penalty in the other direction. Not recommended for large models.

The Correct Architecture

If you need both Windows and WSL to serve models:

1. Run Ollama in ONE place (WSL or Windows, not both)

2. Expose the API on 0.0.0.0:11434

3. Access from the other environment via HTTP (http://localhost:11434 from either side)

This avoids the cross-filesystem penalty entirely. Both environments share one Ollama instance via the network API.

Set in WSL:

`

export OLLAMA_HOST=0.0.0.0:11434

ollama serve

`

Now Windows tools can hit http://localhost:11434 and WSL tools can hit the same endpoint. One model store, one server, no filesystem bridge.

Docker Considerations

If running Ollama in Docker (common for consistent environments):

`

docker run -d \

-v /path/to/your/models:/root/.ollama/models \

-p 11434:11434 \

ollama/ollama

`

Mount your model directory to /root/.ollama/models inside the container. Do not mount Windows paths into Linux containers via /mnt/c.

Troubleshooting

| Symptom | Cause | Fix |

|---------|-------|-----|

| ollama list empty after setting OLLAMA_MODELS | Path does not contain the correct directory structure | Ensure path points to the folder containing manifests/ and blobs/ subdirectories |

| Models download to old location | Ollama was not restarted after env var change | Fully quit and relaunch Ollama |

| Permission denied (Linux/WSL) | Custom directory not owned by ollama user | sudo chown -R ollama:ollama /your/path |

| Extremely slow model loading in WSL | Models on /mnt/c (Windows filesystem) | Move models to WSL native filesystem or use network API approach |

| OLLAMA_MODELS set but ignored (Windows) | Known bug in some versions | Edit SQLite database directly or update Ollama |

| Symlink not followed | Network drive or unsupported filesystem | Use OLLAMA_MODELS env var instead of symlink |

Summary

The rules are simple:

1. Use OLLAMA_MODELS environment variable. It is the official override.

2. On Windows: set as User variable, restart Ollama.

3. On WSL/Linux with systemd: use override.conf, own the directory.

4. Never cross the Windows/WSL filesystem boundary for model storage. Use the network API instead.

5. Verify with ollama list` after every change.

6. If the env var fails silently on Windows, edit the SQLite database.

References

  • Ollama. (2024). "Windows Documentation." https://docs.ollama.com/windows
  • Ollama. (2024). "FAQ: How can I change where Ollama stores models?" https://docs.ollama.com/faq
  • Ollama GitHub Issue #2551. "Can we change where the models are stored in Windows." https://github.com/ollama/ollama/issues/2551
  • Ollama GitHub Issue #9889. "OLLAMA_MODELS directive not respected (Windows)." https://github.com/ollama/ollama/issues/9889
  • Ollama GitHub Issue #4454. "OLLAMA_MODELS environment variable is not respected." https://github.com/ollama/ollama/issues/4454
  • Ollama GitHub Issue #1723. "Ollama is not loading models from symlinked folders." https://github.com/ollama/ollama/issues/1723
  • LLMHardware.io. (2026). "WSL2 LLM Setup Guide: Run Ollama on Windows with Linux Performance." https://llmhardware.io/guides/wsl2-llm-setup-guide
  • Microsoft. (2024). "File system performance across Windows and Linux operating systems." WSL Documentation.

Cite as

devinfo.dev. (2026). "Ollama Beyond Defaults: Custom Model Paths on Windows and WSL." devinfo.dev:2026.0010. https://devinfo.dev/d/2026.0010

devinfo.dev | https://devinfo.dev/d/2026.0010
Content licensed under CC BY-NC 4.0. Free to share with attribution for non-commercial use.
https://devinfo.dev