Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

How to Change the Ollama Model Path on Linux

A complete Linux guide to changing Ollama’s model directory, moving existing downloads, configuring systemd, and troubleshooting path and permission problems.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set Ollama’s OLLAMA_MODELS variable to an absolute directory, then reload and restart the systemd service. For a standard Linux installation, the service normally stores models in /usr/share/ollama/.ollama/models. Changing the variable only changes where Ollama looks; it does not move models already downloaded. Create the destination, grant it to the ollama account, move the existing blobs and manifests directories or pull the models again, and verify the service logs.

What changing the model path actually changes

Ollama uses the OLLAMA_MODELS environment variable to choose its model directory. The value must be an absolute path, such as /mnt/large-drive/ollama-models. On Linux with the standard system installer, the documented default is /usr/share/ollama/.ollama/models.

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.

The setting affects the Ollama process that receives it. A systemd service, a manually launched ollama serve, a container, and a distribution-specific launcher can each have a different environment. Consequently, changing a variable in your interactive shell does not automatically change the environment of a system service.

The service account matters

The standard systemd installation runs as the ollama user. The target directory and everything below it must be readable and writable by that account. A path that exists but is owned only by your login user can still produce permission errors when the service starts.

#1 Best Overall
SSK Portable SSD 250GB External Solid State Hard Drive USB C Up to 1050MB/s
  • Capacity Display Variance: 250GB external ssd often appears as around 232GB on Windows. MacOS can show full 250 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

This procedure’s scope

The steps below apply to a native Linux installation managed by systemd. Docker deployments, distribution packages, and custom launchers need the variable added to their own container or service environment. The same variable name is used, but the place where you set it depends on how that Ollama process is started.

Choose the right way to set OLLAMA_MODELS

Approach Persistence Process identity Migration work Best use
systemd drop-in with systemctl edit Survives shell logout and service restarts The system ollama account Move existing blobs and manifests, or re-pull models A normal Linux system installation
Shell export Applies only to commands launched from that shell and its children Your login session or the process you start Move or re-pull models for that process Temporary testing with a manually started server
User-run ollama serve Depends on how you launch it Your login user, which may use a home-directory .ollama Move or re-pull models visible to that user Installations deliberately run outside systemd
Docker, distro package, or custom launcher Controlled by that launcher Defined by the container or launcher Use that environment’s model storage Non-standard installations

If ollama.service is enabled and running, use the systemd method. It is the setting that the service will consistently receive, rather than a variable that exists only in your terminal.

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

Set a persistent path for a systemd installation

1. Pick an absolute destination and confirm the storage is available

Choose a directory on the filesystem that has enough capacity, for example /mnt/large-drive/ollama-models. If this is an external or secondary drive, make sure it is mounted at that path before Ollama starts, including after a reboot. The variable should point to the model directory itself, not merely to the mount’s parent directory.

2. Create the directory and assign ownership

Create the destination with elevated privileges, then give the service account ownership:

sudo mkdir -p /mnt/large-drive/ollama-models
sudo chown -R ollama:ollama /mnt/large-drive/ollama-models

Replace the example path with your chosen absolute directory. The recursive ownership change is important if the directory already contains copied model data.

3. Add a systemd drop-in override

Open the service override editor:

sudo systemctl edit ollama.service

Under the [Service] heading, add exactly one environment assignment:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[Service]
Environment="OLLAMA_MODELS=/mnt/large-drive/ollama-models"

Save and close the editor. A drop-in override is preferable to editing the vendor unit directly because package updates can replace the original unit while leaving the override in place.

Rank #2
Western Digital 4TB My Passport SSD External Portable Solid State Drive, Grey, Up to 1,050 MB/s, USB 3.2 Gen-2 and USB-C Compatible (USB-A for older systems) – WDBAGF0040BGY-WESN
  • Blazing fast NVMe technology with speeds of up to 1050MB/s and write speeds of up to 1000MB/s | Based on read speed unless otherwise stated. As used for transfer rate, 1 MB/s = one million bytes per second. Based on internal testing; performance may vary depending upon host device, usage conditions, drive capacity, and other factors..date transfer rate:1050.0 megabits_per_second.Compatibility : Windows 10+ operating systems, macOS 11+.
  • Password enabled 256-bit AES hardware encryption
  • Shock and vibration resistant. Drop resistant up to 6.5ft (1.98m)
  • Cross Compatible USB 3.2 Gen-2 and USB-C (USB-A for older systems)
  • 5-year manufacturer's limited warranty

4. Reload systemd and restart Ollama

Tell systemd to reread the unit configuration, then restart the service:

sudo systemctl daemon-reload
sudo systemctl restart ollama

The restart is what launches Ollama with the new environment. A daemon reload by itself does not restart an already-running process.

5. Confirm that the service can read the directory

Run:

ollama list

If the directory is new, an empty list can be expected until a model is pulled. Pull a small, known model if necessary, then inspect the service log:

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.
journalctl -u ollama

Look for path, permission, or startup errors. If the service cannot write to the destination, correct ownership and restart it again.

Move models you already downloaded

Changing OLLAMA_MODELS does not copy anything from the old location. Existing downloads are represented by the blobs and manifests directories. Until those directories are present in the new location, the service can show no models even though the old disk still contains them.

Option A: copy the existing model data

Copy both directories from the standard system path while preserving their contents and then apply ownership to the destination. Stop the service during the copy so it cannot modify files while they are being transferred:

sudo systemctl stop ollama
sudo mkdir -p /mnt/large-drive/ollama-models
sudo cp -a /usr/share/ollama/.ollama/models/blobs /mnt/large-drive/ollama-models/
sudo cp -a /usr/share/ollama/.ollama/models/manifests /mnt/large-drive/ollama-models/
sudo chown -R ollama:ollama /mnt/large-drive/ollama-models
sudo systemctl daemon-reload
sudo systemctl restart ollama

The destination should end up with /mnt/large-drive/ollama-models/blobs and /mnt/large-drive/ollama-models/manifests. If you use a different destination, substitute it consistently in the copy, ownership, and systemd settings. Check ollama list before deleting anything from the old location. Keep the old data until the new service lists the expected models and can run one successfully.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
SSK Portable SSD 2TB External Solid State Drives, up to 1050MB/s USB C SSD External Hard Drive USB 3.2 Gen2 for iPhone 15/Pro, Windows, Mac, Android Phones and Tablets
  • Capacity Reminder: Display capacity of 2TB SSD often appears as around 1863GB on Windows. MacOS typically shows full 2TB. This display capacity reduction of 7% to 10% from SSD actual capacity is from algorithms differences in which 1GB is interpreted as 1024MB on Windows and 1000MB on SSDs
  • 1000 MB/s Speed: Instantly access to your files with blazing-fast 10Gbps external SSD read up to 1000MB/s and write up to 1000MB/s. LED Light indicates USB SSD instant activity
  • Data Security: Master solid state drives health with S.M.A.R.T. monitoring. TRIM technology ensures consistent write speeds and extends the lifespan of the portable SSD
  • USB-C & USB-A Cable: Both USB-C and USB-A cables featuring rapid USB 3.2 Gen2, this USB SSD effortlessly bridges devices, enabling seamless cross-platform file transfers between computers, smartphones, tablets and Phones
  • Always Fast: No slowdowns during large file transfers. When transferring files smaller than 500GB, this external ssd remains steady 10Gbps with SLC caching (25%of the current available capacity is allocated for high speed cache)

Option B: pull models again

If the old data is disposable, unavailable, or too difficult to copy, leave the old directory alone and pull each required model after the service is restarted with the new path. The downloads will be written to the new directory. This uses additional bandwidth and disk space during the transition, but avoids manipulating the existing model files.

Do not copy only one of the two directories

The model store uses both blobs and manifests. Moving only one can leave metadata without its content, or content without the references Ollama needs. Treat the pair as one model store and preserve their directory names.

Verify which Ollama process you are actually using

A frequent source of confusion is running a second unmanaged server while testing the systemd change. A manually started ollama serve can inherit a different environment from ollama.service, making it appear that the override was ignored.

  1. Use one server process while testing. If the systemd service is your intended installation, do not start another ollama serve in a terminal.
  2. Restart the service after editing the override with sudo systemctl daemon-reload followed by sudo systemctl restart ollama.
  3. Run ollama list against that service and, if needed, pull a small known model.
  4. Read journalctl -u ollama for errors from the service process rather than relying on output from a separate terminal process.

If a manually launched server is the one answering your client commands, its user-home directory may be used instead of the systemd destination. Stop that unmanaged process and test again through the single service instance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why Ollama may still use ~/.ollama/models

A shell export changed the wrong process

Setting OLLAMA_MODELS in a terminal affects programs launched from that terminal. It does not rewrite the environment of an already-running systemd service. Put the assignment in the systemd drop-in when the service is the process that should use the new path.

The service was not reloaded and restarted

Editing the override file does not alter a running process. Run both commands in order:

sudo systemctl daemon-reload
sudo systemctl restart ollama

A second server is responding

A manually started ollama serve may use a user-home .ollama directory and a different variable value. Ensure only the intended server is running before judging the systemd configuration.

Rank #4
Corsair EX400U 1TB USB4 Portable External Type-C SSD – 3.2 Gen2 2x2 Connections, Up to 40Gbps, Plug and Play, MagSafe, Includes Cable – Windows PC, iOS Mac – Gray
  • External SSD with USB4 Connection: Leverage the incredibly high bandwidth of USB4 to move large files for tasks like video and photo editing in seconds.
  • Lightning-Fast Speeds: Delivers data speeds of up to 4,000MB/sec sequential read and up to 3,500MB/sec sequential write.
  • Compatible with USB Type-C: Connect via USB Type-C, Thunderbolt 4 and higher for wide compatibility*. *Performance varies by capacity. Maximum performance requires USB4 or higher connection.
  • Compact Form Factor: Small form factor allows you to take the EX400U with you for high-performance storage on the go.
  • Simple Plug-and-Play Setup: Easy to use right out of the box with a single connection for power and data on PC or Mac.

The model data was not migrated

The new directory can be correctly configured and still appear empty. Copy both blobs and manifests, or pull the models again. The variable changes the lookup location; it is not a migration command.

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

The service account cannot access the destination

Check that the destination and its contents are owned by ollama:ollama and that the service account has read and write access. Correct the ownership with:

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

Restart the service and inspect journalctl -u ollama for any remaining permission error.

The drive is not mounted when the service starts

For a secondary or external drive, the path must refer to the mounted filesystem before Ollama starts. Confirm the mount is available during boot and before restarting the service. Otherwise, Ollama may not be able to create or read the intended model directory.

Use a temporary shell-only path when testing

For a user-run server, you can set the variable in the same shell before launching Ollama:

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.
export OLLAMA_MODELS=/mnt/large-drive/ollama-models
ollama serve

This is useful for a quick test, but it is not a persistent systemd configuration. Closing the shell, starting the service through systemd, or launching Ollama from another context can produce a different environment. Do not use this method as a substitute for the drop-in override when the system service is your normal installation.

Installation-specific differences

Native systemd installation

Use sudo systemctl edit ollama.service, set the variable under [Service], reload systemd, restart Ollama, and ensure the ollama account owns the destination. The documented default path for this setup is /usr/share/ollama/.ollama/models.

Manually launched Linux process

Set OLLAMA_MODELS in the environment that launches ollama serve. The process may use a directory under the launching user’s home when no override is supplied. Keep the shell and server consistent so you do not compare one process’s model store with another’s.

Docker, distribution packages, and custom launchers

Set OLLAMA_MODELS in the container environment, package service definition, or launcher configuration that actually starts Ollama. The systemd drop-in above affects only ollama.service; it cannot change an unrelated container or supervisor.

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

A practical checklist

  • Choose an absolute destination on storage that is mounted before Ollama starts.
  • Create the directory with sudo mkdir -p.
  • Give the system service account ownership with sudo chown -R ollama:ollama.
  • Add Environment="OLLAMA_MODELS=..." under [Service] using sudo systemctl edit ollama.service.
  • Run sudo systemctl daemon-reload and sudo systemctl restart ollama.
  • Move both blobs and manifests, or re-pull every required model.
  • Use ollama list and journalctl -u ollama to verify the service’s result.
  • Avoid a second unmanaged ollama serve while diagnosing the configuration.

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 from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.