Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
VGSources
Blog

How to Back Up Ollama Models on a Linux VPS

A practical Linux VPS runbook for finding Ollama’s model directory, backing up every blob and manifest safely, restoring without re-downloading, and moving models to a larger mounted volume.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To back up Ollama on a Linux VPS, stop the Ollama service, copy the entire active model directory with its blobs and metadata, preserve ownership and filesystem attributes, then restart and test the service. A standard Linux service installation stores models in /usr/share/ollama/.ollama/models. If the service uses OLLAMA_MODELS, back up that custom directory instead.

This procedure lets you restore models without downloading them again, move them to a larger disk, and keep your VPS root volume from filling up.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Find the directory Ollama is actually using

Do not assume that a model label such as llama3 is a complete backup. Ollama maintains a store containing manifests, metadata, and content-addressed blob files. The complete directory is required for a reliable restore.

Standard installation path

With the standard Linux service installation and no override, the model store is:

#1 Best Overall
Sandisk 2TB Extreme Portable SSD, Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware, External Solid State Drive, SDSSDE61-2T00-G25
  • Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
  • Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
  • Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
  • Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
  • Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C
/usr/share/ollama/.ollama/models

The service normally runs under the dedicated ollama account. That account must be able to read and write the model directory.

Check for a custom OLLAMA_MODELS setting

A custom OLLAMA_MODELS value changes the location. Environment settings can be defined in the unit file or in a systemd drop-in, so inspect the service rather than relying on the environment of your interactive shell:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
systemctl cat ollama.service
systemctl show ollama --property=Environment

Look for an entry such as OLLAMA_MODELS=/mnt/models/ollama. Use that path as the source for every backup and restore command. If no override is present, use /usr/share/ollama/.ollama/models.

Record the configuration before changing anything

Save the details needed to reproduce the installation:

ollama version
systemctl show ollama --property=Environment
findmnt -T /usr/share/ollama/.ollama/models
df -h /usr/share/ollama/.ollama/models
du -sh /usr/share/ollama/.ollama/models

Replace the path in the last two commands if OLLAMA_MODELS points elsewhere. Record the Ollama version, active model path, backup time in UTC, destination filesystem, and available free space. There is no universal backup-size or recovery-time figure: model collections differ, so measure the directory you own.

Prepare a safe backup destination

Use a mounted disk, a separate VPS volume, or removable/off-site storage with more free capacity than the source directory. Check that the destination is mounted before copying; otherwise a copy can silently land on the VPS root filesystem and exhaust it.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
findmnt /mnt/backup
df -h /mnt/backup

Create a dedicated destination directory:

sudo mkdir -p /mnt/backup/ollama-models

A backup should survive a failure of the VPS disk. Keep at least one additional copy in a different failure domain, such as an encrypted off-site copy. Protect removable and off-site media with encryption, and keep storage credentials separate from the backup itself. Never publish the model directory through a public HTTP server.

Rank #2
SSK Portable SSD 500GB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 500GB external ssd often appears as around 465GB on Windows. MacOS can show full 500 GB capacity. This is binary calculation difference and doesn’t affect SSD hard drive actual physical storage
  • 1050 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1050MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Solid state drives S.M.A.R.T. health diagnostics​ and adaptive TRIM optimizing data block management ensures consistent write speeds and extends the longevity of the portable SSD
  • USB-C & USB-A Cable: Both cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers and backup between computers, smartphones, tablets and iPhone
  • Always Fast: No slowdowns for large file transfers. With SLC caching (25% of current available capacity allocated as high-speed cache), this external SSD delivers steady 10Gbps for transfers within the cache capacity

Back up the model store step by step

1. Stop Ollama before a filesystem copy

Stopping the service prevents files from changing while the copy is in progress. This is a consistency precaution for filesystem-level backups:

sudo systemctl stop ollama
sudo systemctl is-active ollama

The second command should report inactive. If it still reports active, investigate the service status before copying.

2. Copy every subdirectory and preserve metadata

rsync is convenient for a repeatable directory copy. The trailing slash on the source means “copy the contents of this directory” rather than creating an extra nested models directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo rsync -aHAX --numeric-ids 
  /usr/share/ollama/.ollama/models/ 
  /mnt/backup/ollama-models/

If the service uses a custom path, replace /usr/share/ollama/.ollama/models/ with the directory shown by OLLAMA_MODELS. The options preserve ownership, permissions, hard links, ACLs, extended attributes, and timestamps; --numeric-ids records numeric owners instead of remapping them by name.

3. Use an archive when rsync is unavailable

An archive is useful when moving one self-contained backup file to another system:

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 model directory, change the -C argument to its parent directory and keep the final directory name as the archive member. Ensure the destination has enough free space for both the archive and any temporary filesystem overhead.

4. Verify the copy while Ollama is still stopped

Run an rsync dry run against the destination. With no changes expected, it should produce no file-transfer list:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model) | External Solid State Drive, Compatible with Laptops & Tablets, Up to 2M Drop Protection, USB 3.2 Gen 2, USB-C to USB-A Cable
  • Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
  • Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
  • Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
  • Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
  • From Sandisk, a brand professional photographers trust to take on assignments.
sudo rsync -aHAXn --delete --numeric-ids 
  /usr/share/ollama/.ollama/models/ 
  /mnt/backup/ollama-models/

For a custom path, substitute that path in the source position. Also compare the apparent sizes:

sudo du -sh /usr/share/ollama/.ollama/models
sudo du -sh /mnt/backup/ollama-models

A dry run checks what rsync would change; it is not a cryptographic proof that every storage device is healthy. If your operational policy requires checksums, perform a checksum pass before deleting or overwriting the original. Keep the original model directory until the backup has passed validation.

5. Start Ollama and validate the live installation

sudo systemctl start ollama
sudo systemctl status ollama --no-pager
ollama list

The model names listed after the restart should match the pre-backup inventory. Exercise one known-installed model with a small request:

ollama run MODEL_NAME 'Reply with the word OK.'

Replace MODEL_NAME with a name shown by ollama list. If startup fails, inspect the service log:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
journalctl -u ollama --no-pager -n 100

Choose between rsync and an archive

Method Best use Important behavior
rsync -aHAX --numeric-ids Repeatable backups to a mounted directory Copies the complete tree and preserves ownership, modes, links, ACLs, extended attributes, and timestamps. A later run can transfer only differences.
tar --xattrs --acls -czf One portable backup file Packages the model tree for transport. Restore requires extracting it into the correct parent directory and then checking ownership.

Neither utility is mandated by Ollama. They are operational choices; the essential requirements are a quiesced service, a complete model tree, preserved metadata, and a validation run.

Restore Ollama models without downloading them

Restore into the directory selected by the active service configuration. Do not delete the current directory at the start: moving it aside gives you a rollback path if the backup is incomplete or the path is wrong.

  1. Stop the service.
    sudo systemctl stop ollama
    sudo systemctl is-active ollama
  2. Move the current store aside. Use a timestamped name on the same filesystem so the operation is quick and reversible:
    sudo mv /usr/share/ollama/.ollama/models 
      /usr/share/ollama/.ollama/models.before-restore-$(date -u +%Y%m%dT%H%M%SZ)
    sudo mkdir -p /usr/share/ollama/.ollama/models

    Replace the path when OLLAMA_MODELS is customized.

  3. Restore the complete backup. For an rsync directory, copy its contents into the active model directory:
    sudo rsync -aHAX --numeric-ids 
      /mnt/backup/ollama-models/ 
      /usr/share/ollama/.ollama/models/

    For an archive, extract it from the parent directory expected by the archive layout:

    Rank #4
    Sale
    Samsung T7 Portable SSD 1TB Titan Gray, USB 3.2 Gen 2, Up to 1,050MB/s | Reliable External Solid State Drive Storage for Gaming, Students, Professionals (MU-PC1T0T/AM)
    • MADE FOR THE MAKERS: Create; Explore; Store; The T7 Portable SSD delivers fast speeds and durable features to back up any endeavor; Build your video editing empire, file your photographs or back up your blogs all in an instant
    • SHARE IDEAS IN A FLASH: Don’t waste a second waiting and spend more time doing; The T7 is embedded with PCIe NVMe technology that brings fast read and write speeds up to 1,050/1,000 MB/s¹, making it almost twice as fast as the T5
    • ALWAYS MAKE THE SAVE: Compact design with massive capacity; With capacities up to 4TB, save exactly what you need to your drive – from large working files to game data and everything in between
    • ADAPTS TO EVERY NEED: Whether using a PC or mobile phone, count on the T7 for extensive compatibility²; It’s a true team player when it comes to heavy-duty application usage or file-saving
    • HI RESOLUTION VIDEO RECORDING: Record Ultra High Resolution (4K 60fs) videos directly onto the T7 Portable SSD with your favorite camera or mobile devices; Supports iPhone 15 Pro Res 4K at 60fps video and more³
    sudo tar --xattrs --acls -xzf /mnt/backup/ollama-models-TIMESTAMP.tar.gz 
      -C /usr/share/ollama/.ollama
  4. Set ownership for the service account.
    sudo chown -R ollama:ollama /usr/share/ollama/.ollama/models

    Use the actual custom directory if one is configured. Avoid making the store world-writable; grant only the service account and authorized administrators the access they need.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  5. Start and validate.
    sudo systemctl start ollama
    sudo systemctl status ollama --no-pager
    ollama list
    ollama run MODEL_NAME 'Reply with the word OK.'
  6. Keep the old directory until validation succeeds. Once the model list and inference request work, retain or remove the old directory according to your retention policy. If validation fails, stop Ollama, move the restored directory aside, and put the pre-restore directory back in its original location.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Move models to a larger VPS volume or external disk

Moving the store is useful when model files would otherwise consume the VPS root volume. The destination must be mounted reliably before Ollama starts and writable by the ollama service account.

Copy the existing store to the mounted volume

Mount the new filesystem, create a directory, stop Ollama, and copy the complete tree:

sudo mkdir -p /mnt/ollama-models
sudo systemctl stop ollama
sudo rsync -aHAX --numeric-ids 
  /usr/share/ollama/.ollama/models/ 
  /mnt/ollama-models/

Check the destination with a dry run before changing the service configuration:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo rsync -aHAXn --delete --numeric-ids 
  /usr/share/ollama/.ollama/models/ 
  /mnt/ollama-models/

Create a systemd drop-in

Open the service override editor:

sudo systemctl edit ollama.service

Add a [Service] section with the mounted path:

[Service]
Environment=OLLAMA_MODELS=/mnt/ollama-models

Save and close the editor, then reload systemd and restart Ollama:

sudo systemctl daemon-reload
sudo systemctl restart ollama

Confirm that the service received the setting:

systemctl show ollama --property=Environment
ollama list

Run the small inference check described above. Do not remove the original store until the new mount, permissions, model listing, and inference have all passed. If the disk is not mounted during boot, Ollama can start against an empty directory or fail, depending on the service and filesystem state; configure your VPS mount to be available before the service starts.

Fix ownership and mount permissions

After copying, make the service account the owner:

sudo chown -R ollama:ollama /mnt/ollama-models

Then test access as the service account without exposing the directory to other users:

Best Value
Sale
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model | External Solid State Drive, IP65 Water & Dust Resistant, Up to 3M Drop Protection, 256-bit AES Encryption, USB-C 3.2 Gen 2
  • NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
  • IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
  • POCKET-SIZED – fits easily in pockets and small bags.
  • SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
  • 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.
sudo -u ollama test -r /mnt/ollama-models
sudo -u ollama test -w /mnt/ollama-models

Both tests should succeed. A restrictive mount or parent directory permission can still block access even when the model directory itself has the right owner, so check each parent directory if the tests fail.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common failures and recovery steps

ollama list is empty after a restore

  • Check the active service environment with systemctl show ollama --property=Environment; the restored files may be in a different directory.
  • Verify that the backup contains the complete tree, including blob data and subdirectories, not merely a manually selected model label.
  • Check ownership with ls -ld and restore ollama:ollama ownership where appropriate.
  • Confirm that the intended filesystem is mounted and that the path is not an empty directory on the VPS root volume.

The service fails to start

Read the recent unit log and status output:

sudo systemctl status ollama --no-pager
journalctl -u ollama --no-pager -n 100

Typical causes during a move are a missing mount, an incorrect drop-in path, a typo in OLLAMA_MODELS, or insufficient permissions. Correct the configuration, run sudo systemctl daemon-reload after editing the unit, and restart.

The copy reports permission or attribute errors

Run the copy as root and verify that the destination filesystem supports the metadata you intend to preserve. If a destination cannot represent ACLs or extended attributes, document that limitation rather than assuming the backup is equivalent. Check the rsync exit status and repeat the dry run after correcting the filesystem or command.

The VPS runs out of space

Stop the copy, check df -h on both filesystems, and remove only incomplete temporary data after confirming which directory is active. Never delete the original model store until a separate backup has been verified and the running service has passed its model-list and inference checks.

Retention and security practices

  • Use least-privilege permissions and keep the model store inaccessible to untrusted users.
  • Encrypt removable and off-site media. Store encryption keys or credentials separately from the backup.
  • Keep copies on different failure domains; a second directory on the same physical disk does not protect against disk failure.
  • Label each backup with its UTC timestamp, Ollama version, active model path, destination filesystem, and validation result.
  • Schedule filesystem copies during a maintenance window in which Ollama can be stopped. An online copy can observe a changing store and should not be treated as equivalent to a quiesced backup unless you have a separate consistency mechanism.
  • Periodically perform a test restore to a disposable directory or host. A backup that has never been restored is only an unverified copy.

What this method does and does not preserve

Copying the model directory preserves the locally installed model data, manifests, and blob files needed for Ollama to recognize and run those models. It does not automatically reproduce unrelated VPS configuration, firewall rules, systemd overrides, mount definitions, user accounts, application data, or secrets. Record the OLLAMA_MODELS setting and service configuration alongside the model backup, and back up other application data with its own procedure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Model collections can be very large, and their size depends on which models and variants you have installed. No authoritative universal backup-size statistic or recovery-time benchmark applies to every VPS, so use the measured du size, destination throughput, and your own restore test to set retention and maintenance windows.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.