Moving and Migrating Ollama Models
What this article covers
- How to export and import Ollama models.
- How to transfer models to another machine.
- What files live in the
.ollamadirectory. - How to mirror or sync models.
- Troubleshooting tips.
Getting started: moving and migrating Ollama models
Ollama stores models locally in the .ollama directory. If you’re setting up a new system or want to move models from one machine to another, you need to transfer these files correctly. A simple directory copy usually works, but depending on your platform and Ollama version, some details matter. For occasional transfers, Ollama also provides its own import and export mechanisms.
This article walks through the most common approaches to moving and migrating Ollama models.
Key terms
- Modelfile: Recipe for a model with base, parameters, and template.
- Blob: Model weights file.
- Manifest: Metadata file that references blobs.
- .ollama: Standard directory for Ollama data.
- Export: Save a model to a file.
- Import: Load a model from a file.
- rsync: File synchronization tool.
- GGUF: Format for model weights.
Where Ollama stores data
Default paths:
- Linux:
~/.ollama - macOS:
~/.ollama - Windows:
C:\Users\<Username>\.ollama
Directory structure:
.ollama/
models/
manifests/
blobs/
Packaging a model
You can’t directly export a single model as a package using ollama show and ollama pull. Instead, copy the .ollama directory.
Copying to a new machine
Option 1: Archive
# On the old machine
tar -czf ollama-backup.tar.gz -C ~/.ollama .
# On the new machine
tar -xzf ollama-backup.tar.gz -C ~/.ollama
Stop Ollama before copying and restart it afterward.
Option 2: rsync over network
rsync -avz --progress ~/.ollama/models/ new-server:/home/user/.ollama/models/
Option 3: External drive
# Copy old directory
cp -r ~/.ollama /path/to/backup/
# On new machine
cp -r /path/to/backup/.ollama ~/
Copying individual models only
Transferring just specific models requires care, since manifests reference blobs. A simpler approach:
- Back up the Modelfile on the old system:
ollama show --modelfile llama3.1 > llama3.1.modelfile
- Copy the Modelfile and associated blobs to the new machine.
- Restart Ollama or run
ollama createwith the Modelfile.
Importing a model from GGUF
ollama create my-model -f ./Modelfile
Modelfile example:
FROM ./my-model.gguf
PARAMETER temperature 0.7
SYSTEM "Helpful assistant"
Stop Ollama before copying
sudo systemctl stop ollama
After copying:
sudo systemctl start ollama
Platform considerations
- Models are platform-agnostic as long as they use the same format.
- x86 and ARM each need their own binaries.
- GPU drivers must match on the target system.
Keeping systems in sync
For multiple machines, rsync or network storage can help:
# Syncs .ollama between two hosts
rsync -avz --delete -e ssh host1:/home/user/.ollama/models/ /home/user/.ollama/models/
Tips
- Check available space first.
- Stop Ollama before copying files.
- Fix permissions and ownership on the new system.
- Copy manifests along with models.
- Match Ollama versions on both systems.
- Back up before major changes.
Common pitfalls
- Ollama running during copy: Files can become corrupted.
- Wrong permissions: Ollama can’t read the models.
- Missing manifest: Model doesn’t appear in
ollama list. - Low disk space: Target system doesn’t have enough room.
- Incompatible version: Newer Ollama might need a different format.
- Windows paths: Watch out for slashes and drive letters.
Further reading
- BotServ.de Ollama Backup
- BotServ.de Ollama Model Updates
- BotServ.de Ollama Model Lifecycle
- BotServ.de Ollama Commands
FAQ: Moving Ollama models
Can I just copy the .ollama directory? Yes, as long as Ollama is stopped and permissions are correct.
Are models compatible between Linux and macOS? Yes, GGUF models are platform-agnostic.
How do I transfer just one model? Copy the Modelfile and associated blobs, or reimport the model.
Can I do this over USB? Yes, as long as files are copied correctly.
Do I need to reinstall Ollama? Ollama must be installed on the target system, but configuration and data can be carried over.
Sources and further resources
- Ollama GitHub: https://github.com/ollama/ollama
- GGUF Format: https://github.com/ggerganov/ggml/blob/master/docs/gguf.md
- Ollama CLI: https://ollama.com/
Summary: Moving and migrating Ollama models
Moving Ollama models is easiest through the .ollama directory. Stop Ollama beforehand to keep files consistent. For individual models, transfer Modelfiles and blobs or reimport them. Platform compatibility, disk space, permissions, and matching Ollama versions are the key factors. Keep these points in mind and you’ll move models between machines, servers, and backups without trouble.


