Module 7 Lesson 2: Disk Space Management
Managing the gigabytes. How to clear space and move your Ollama model library to a larger drive.
Disk Space: Managing the AI Library
If you catch the "Ollama Fever," you will soon find yourself pulling every model in the registry. Llama 3 (5GB), Mistral (4GB), Command R (24GB)... suddenly, your 512GB SSD is full.
Here is how to manage the "Bloat."
1. Finding the Bloat
Run ollama list.
This is your primary inventory. Look for models you haven't used in weeks.
To delete a model and instantly reclaim space:
ollama rm model-name
2. Where are the files stored?
Ollama stores models in a hidden folder.
- macOS/Linux:
~/.ollama/models - Windows:
C:\Users\<username>\.ollama\models
Note: You won't see "Llama-3" files in there. Ollama uses a content-addressed storage (blobs). Do not try to delete files manually from these folders; always use ollama rm.
3. Moving the Library to an External Drive
If your main laptop drive is small, you can move your models to a larger external SSD or a second internal drive.
On Windows:
- Close Ollama.
- Set a system-wide Environment Variable:
OLLAMA_MODELSto your new path (e.g.,D:\OllamaModels). - Restart Ollama.
On macOS/Linux:
- Stop the Ollama service.
- Export the variable in your shell profile (
.zshrcor.bashrc):export OLLAMA_MODELS=/Volumes/ExternalSSD/ollama/models. - Restart the service.
4. Pruning the Registry
Over time, Ollama might have "dangling" manifest files if a download was interrupted. While rare, you can usually fix this by running ollama pull [model] again to ensure the file is complete, or ollama rm to purge it.
Summary Checklist
- Inventory: Run
ollama listweekly. - Removal: Delete models that were just for "testing."
- Expansion: Use
OLLAMA_MODELSto point to a high-capacity drive. - Health Check: Ensure you have at least 10% free space on your system drive for the OS to run smoothly.
Key Takeaways
- Models are large and consume disk space rapidly.
- Use
ollama rmas the only safe way to delete models. - The OLLAMA_MODELS environment variable allows you to host models on any drive.
- Avoid using slow external HDDs (Hard Drives); only use external SSDs for model storage.