Ollama stores downloaded models in default model directories that can quickly fill the system drive, especially on Windows. The practical fix is to know the default path first, then move model storage with OLLAMA_MODELS before downloading large local LLMs.
When running local LLMs, the system drive is often the first thing to run out of space. Ollama stores models in user or system directories by default, so your C drive can fill up quickly without path planning.
Quick Answer
Ollama normally stores models under %USERPROFILE%\.ollama\models on Windows, ~/.ollama/models on macOS, and the Ollama service account’s .ollama/models directory on Linux. To move them, stop Ollama, copy the existing model directory, set OLLAMA_MODELS to the new absolute path, restart Ollama, and verify an installed model before deleting the old copy.
Common Default Ollama Model Directories
- Windows:
C:\Users\<username>\.ollama\models - macOS:
~/.ollama/models - Linux:
/usr/share/ollama/.ollama/models(may vary by installation method)
Windows: Move the Model Directory to a Non-System Drive
A practical choice is moving model storage to a path like D:\OllamaModels. The key is setting the OLLAMA_MODELS system environment variable.
1. Create the Target Directory
For example, create: D:\OllamaModels
2. Configure the System Environment Variable
- Variable name:
OLLAMA_MODELS - Variable value:
D:\OllamaModels
You can set it in “System Properties -> Advanced -> Environment Variables”, or with an admin PowerShell command:
|
|
3. Restart Ollama (or Reboot the System)
After setting the variable, restart the Ollama service/app. If you’re unsure whether it has taken effect, rebooting the PC is the most reliable option.
4. Verify the New Path Is Active
Pull any model and check whether new files appear under D:\OllamaModels.
5. Clean Up the Old Directory (After Confirmation)
Once models work correctly in the new location, remove old files to reclaim C drive space.
Safe Migration, Verification, and Rollback
First identify how Ollama was installed. The Windows desktop app normally uses the current user’s environment, while the Linux systemd service runs as the ollama account. A variable configured for the wrong account will not affect the service.
On Linux, use a systemd override:
|
|
|
|
|
|
Do not move a live model directory. Stop Ollama, copy the data, compare file counts and total bytes, set OLLAMA_MODELS, restart, and run a minimal inference. On Windows, robocopy exit codes 0–7 are normally nonfatal; 8 or higher requires investigation.
|
|
Keep the old directory until the next successful restart. If verification fails, stop Ollama, remove or restore OLLAMA_MODELS, restart, and confirm the old model list. On Linux, also verify that the ollama account can read the destination.
FAQ
Still Writing to C Drive After Configuration
- Confirm the variable is a system variable, not a temporary session variable.
- Confirm the Ollama process was restarted.
- Verify the variable name is exactly
OLLAMA_MODELS.
Do I Need to Migrate Existing Model Files
If you want to avoid re-downloading, stop Ollama, copy existing model files to the new directory, then restart Ollama and verify.