The safest Ollama backup is a copy of the entire model store, made while the Ollama service is stopped. On a standard Linux installation that store is /usr/share/ollama/.ollama/models. If OLLAMA_MODELS is configured, use that directory instead, ensure the ollama service account can read and write it, preserve filesystem metadata, and validate the copy with ollama list and a small inference request after restarting.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
Where Ollama stores models on Linux
The standard Linux service installation keeps Ollama models under /usr/share/ollama/.ollama/models. This is a directory tree, not one file per model. Manifests, layers and blob data live in subdirectories, so backing up only a model label or a visible manifest will not produce a usable restore.
As an Amazon Associate I earn from qualifying purchases.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsOllama can be pointed at another location with the OLLAMA_MODELS environment variable. A custom path may be a second virtual disk, a mounted data volume or an external SSD. The directory must already be mounted when the service starts, and the account used by the systemd service must have read and write permission.
| Installation state | Model directory to back up | Permission requirement |
|---|---|---|
| Standard Linux service with no override | /usr/share/ollama/.ollama/models |
The ollama service account must be able to read and write the tree |
OLLAMA_MODELS set in a unit or drop-in |
The exact path assigned to OLLAMA_MODELS |
The service account must be able to read and write that custom path |
| Path on a mounted volume | The mounted directory, not the empty mount point underneath it | The volume must mount before Ollama starts and retain ownership and permissions |
Find the active path before copying
Do not assume the default if this VPS has been customized. Inspect the complete unit, including drop-ins, and then inspect the environment systemd passes to the service:
#1 Best Overall
- Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
systemctl cat ollama.service
systemctl show ollama --property=Environment
Look for an OLLAMA_MODELS=... entry. If no override is present, use /usr/share/ollama/.ollama/models. Record the selected path in your backup notes so a future restore does not accidentally target a different disk.
Check the service account and space
The Linux service normally runs as the ollama user. Confirm the unit’s account and inspect the files before scheduling a copy:
systemctl show ollama --property=User
sudo du -sh /usr/share/ollama/.ollama/models
sudo df -h /usr/share/ollama/.ollama/models
Replace the path in the last two commands when a custom directory is active. The destination needs room for the complete tree plus temporary filesystem overhead. No authoritative Ollama publication gives a universal backup-size figure: model collections vary by model, quantization and the number of installed versions.
Prepare a backup that can actually be restored
Before stopping the service, decide where the copy will live and how it will be protected. A different filesystem is preferable to another directory on the same VPS disk; a second failure domain, such as encrypted off-site storage, protects against a disk or host failure.
- Mount the destination and verify that it is writable by root.
- Confirm available capacity with
df -h; include growth room for future models. - Choose a retention policy, such as keeping the newest copy and an older known-good copy.
- Keep encryption keys, VPS credentials and any decryption passphrase separate from the backup media.
- Never publish the model directory through an unauthenticated HTTP server.
A portable external SSD is useful when the VPS provider allows a mounted block device or when you can copy the backup after downloading it. Treat the SSD as backup media: encrypt it, label the filesystem, and disconnect it when the copy is complete if the threat model includes ransomware or accidental deletion.
Back up Ollama models step by step
1. Identify the source and destination
Set shell variables only after confirming the active path. The example below uses the standard installation:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteSOURCE=/usr/share/ollama/.ollama/models
DEST=/mnt/backup/ollama-models
sudo mkdir -p "$DEST"
sudo df -h "$DEST"
If systemctl show revealed a custom OLLAMA_MODELS path, replace SOURCE with that exact directory. Keep the trailing slash on the source in the rsync command below; it copies the contents of the model store into the destination rather than creating an extra nested models directory.
Rank #2
- Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
2. Stop Ollama and confirm it is quiescent
Filesystem-level copying should be done with the service stopped so that manifests and blobs cannot change during the copy:
sudo systemctl stop ollama
sudo systemctl is-active ollama
The second command should report inactive. If it reports active, wait for the stop operation to finish and inspect the unit status before proceeding. This pause is a consistency precaution; it avoids capturing a model while a pull, delete or other write is in progress.
3. Copy the complete model tree with metadata
rsync is a practical choice because it preserves the tree and can later perform an incremental copy:
sudo rsync -aHAX --numeric-ids
"$SOURCE"/
"$DEST"/
The options matter:
| Option | Purpose |
|---|---|
-a |
Archive mode: recursive copy with permissions, ownership, timestamps and symbolic links |
-H |
Preserve hard links, if present |
-A |
Preserve POSIX access-control lists |
-X |
Preserve extended attributes |
--numeric-ids |
Keep numeric owner and group IDs rather than translating names between systems |
Run the command as root so it can read every blob and preserve ownership. Copying only a named model, a manifest file or a subset of the blobs directory creates an incomplete store that may appear in a listing but fail when loaded.
4. Use an archive when rsync is unavailable
On a minimal VPS, create a compressed archive while Ollama is stopped:
sudo tar --xattrs --acls -czf /mnt/backup/ollama-models-$(date -u +%Y%m%dT%H%M%SZ).tar.gz
-C /usr/share/ollama/.ollama models
For a custom location, change the directory after -C and the final directory name to match the active model store. Keep the archive on a filesystem with enough free space; compression can require temporary working space. An archive is convenient for transport, while an rsync mirror is generally easier to update incrementally.
5. Verify the copy before bringing the service back
A successful exit status is not proof that the destination contains every file. Compare the trees with a dry run:
Rank #3
- Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
sudo rsync -aHAXn --delete --numeric-ids
"$SOURCE"/
"$DEST"/
With a matching source and destination, the dry run should produce no file changes. The --delete flag is safe here because -n makes this invocation a simulation; do not use it against a destination containing unrelated files unless you understand which entries would be removed. You can also compare apparent sizes:
sudo du -sh "$SOURCE" "$DEST"
For higher assurance, run a checksum comparison on a quiet system. It takes longer and reads every file, but can detect content differences that size checks miss. Record these details with the backup:
- UTC backup timestamp.
- Output of
ollama versionorollama -v. - The active
OLLAMA_MODELSvalue, or the fact that the standard path was used. - Source and destination filesystems and free space.
- The command or script used and the retention label assigned to the copy.
6. Restart and test the live service
Once the copy is verified, start Ollama and check both the service and the model index:
sudo systemctl start ollama
sudo systemctl status ollama --no-pager
ollama list
Issue a small request to a model that is known to be installed. A short prompt is enough to verify that the runtime can read the model layers, not merely that a manifest is visible. If startup fails, inspect the service log:
Recommended Free Tools
journalctl -u ollama --no-pager -n 100
Look for permission errors, a missing mount, an invalid environment value or insufficient disk space. Correct the underlying issue, then restart and repeat the listing and inference test.
Move Ollama models to a larger disk
Moving the store is useful when model files are consuming the VPS root volume. The safe sequence is: mount the new volume, copy the existing store, point systemd at the new path, fix ownership, then restart and validate.
1. Mount and prepare the new volume
Create a stable mount point and mount the volume according to your VPS provider’s instructions. Confirm that the mount is present before copying:
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #4
- Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
findmnt /mnt/ollama-models
df -h /mnt/ollama-models
sudo mkdir -p /mnt/ollama-models
Use the actual mount point in your system. If the mount is managed through /etc/fstab, test it with sudo mount -a and make sure the volume will be available before the Ollama service starts after a reboot.
2. Copy the existing store while Ollama is stopped
sudo systemctl stop ollama
sudo rsync -aHAX --numeric-ids
/usr/share/ollama/.ollama/models/
/mnt/ollama-models/
Run the dry-run comparison from the backup procedure before changing configuration. Keep the original directory until the new location has passed a live test.
3. Set OLLAMA_MODELS in a systemd drop-in
Open a drop-in rather than editing the vendor unit directly:
sudo systemctl edit ollama.service
Add:
[Service]
Environment=OLLAMA_MODELS=/mnt/ollama-models
Save the file, then reload unit definitions and restart:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →sudo systemctl daemon-reload
sudo systemctl restart ollama
Inspect the effective environment to ensure the setting was accepted:
systemctl show ollama --property=Environment
4. Fix ownership and validate
The service account must own or otherwise be able to write the new tree. With the standard service account, a typical correction is:
sudo chown -R ollama:ollama /mnt/ollama-models
Apply that command only to the intended model directory. Then run:
Best Value
- Plug-and-play expandability
- SuperSpeed USB 3.2 Gen 1 (5Gbps)
sudo systemctl status ollama --no-pager
ollama list
Send a small inference request before removing the old copy. If the new volume was not mounted, Ollama may have started against an empty directory at the mount point; stop the service, mount the volume correctly and verify the environment again.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Restore models without downloading them again
A restore replaces the active model tree with a previously verified copy. Keep the current directory aside until the restored installation has passed both an index check and an inference request.
- Stop Ollama.
sudo systemctl stop ollama sudo systemctl is-active ollama - Move the current tree out of the way. For example, rename it with a UTC timestamp rather than deleting it immediately:
sudo mv /usr/share/ollama/.ollama/models /usr/share/ollama/.ollama/models-before-restore-$(date -u +%Y%m%dT%H%M%SZ)Use the directory named by
OLLAMA_MODELSwhen a custom path is configured. - Create the target and restore the complete backup. For an
rsyncmirror:sudo mkdir -p /usr/share/ollama/.ollama/models sudo rsync -aHAX --numeric-ids /mnt/backup/ollama-models/ /usr/share/ollama/.ollama/models/For a tar archive, extract it into the parent directory recorded when the archive was made:
sudo tar --xattrs --acls -xzf /mnt/backup/ollama-models-YYYYMMDDTHHMMSSZ.tar.gz -C /usr/share/ollama/.ollama - Restore service ownership.
sudo chown -R ollama:ollama /usr/share/ollama/.ollama/modelsAdjust the path for a custom location. Preserve restrictive permissions; do not make the directory world-writable as a shortcut.
- Start and inspect the service.
sudo systemctl start ollama sudo systemctl status ollama --no-pager ollama list - Run a small inference request. Use a model shown by
ollama list. If it loads and answers, the restored blobs are usable. If it does not, checkjournalctl -u ollama --no-pager -n 100for the precise path, permission or corruption error. - Retain the old directory until validation is complete. After the restored copy works, delete or archive the pre-restore tree only when you are certain no additional files are needed.
Troubleshooting common failures
| Symptom | Likely cause | What to check |
|---|---|---|
ollama list is empty after a restore |
The service is using a different directory, often because OLLAMA_MODELS points elsewhere |
Run systemctl show ollama --property=Environment and restore into that exact path |
| Service starts but a model fails to load | Only a manifest or partial blob set was copied, or files were changed during a live copy | Restore the complete tree from a stopped-service backup and repeat the dry-run comparison |
| Permission denied in the journal | The ollama account cannot traverse, read or write the custom directory |
Check ownership and parent-directory execute permission; use chown -R ollama:ollama on the intended tree |
| Models disappear after reboot | The volume was not mounted before Ollama started | Check findmnt, persistent mount configuration and service ordering; never restore into an unmounted mount point |
| Backup destination fills during the copy | The destination lacks capacity for the complete store or archive overhead | Check df -h, remove unrelated files, or attach a larger volume before retrying |
| Ollama will not start after editing configuration | Malformed drop-in or an invalid path | Review systemctl cat ollama.service, run systemctl daemon-reload, and inspect journalctl -u ollama |
Protect and maintain the backups
Model files can be large, but they are still data that may reveal what your organization runs locally. Use least-privilege access on the backup directory and encrypt removable or off-site media. Keep credentials and encryption keys separate from the media so theft of one does not unlock the other.
Use at least two copies on different failure domains, such as a mounted backup disk plus an encrypted off-site copy. Periodically perform a test restore on spare storage. A backup that has never been restored is an untested assumption; the test should include service startup, ollama list and a real inference request.
For recurring backups, an incremental rsync mirror can reduce transfer work, but still stop Ollama for each filesystem-level snapshot. If your storage platform offers snapshots, coordinate them with a stopped service or another quiescing method; do not assume a crash-consistent snapshot contains a coherent model store.
What is and is not documented
Ollama’s Linux service documentation describes systemd management, status checks, logs and the ollama service account. Its FAQ documents the standard model directory and the OLLAMA_MODELS override. Those documents do not establish a universal backup size, recovery-time target or performance benchmark. Capacity and restore time depend on the models installed, the filesystem, the storage connection and the amount of data being transferred.
The practical standard is therefore operational rather than a published number: identify the active directory, stop the service, copy every subdirectory while preserving metadata, verify the destination, restart, and prove that a model can answer a request. Keeping the old directory until that proof succeeds gives you a straightforward rollback if the new disk or restored copy is incomplete.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Free tools Windows power users keep installed
One-click scans. No signup required.




