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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Set Ollama’s OLLAMA_MODELS variable to an absolute directory, then restart the process that runs Ollama. For the standard Linux systemd installation, the reliable method is to create a service override with sudo systemctl edit ollama.service, add the variable under [Service], run sudo systemctl daemon-reload, and restart Ollama. The destination must exist and be readable and writable by the ollama service account.

Changing the variable only changes where Ollama looks for models; it does not move existing files. You must copy or move the blobs and manifests directories while preserving ownership, or download the models again.

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

What changes when you set OLLAMA_MODELS

OLLAMA_MODELS is Ollama’s supported setting for choosing a model directory. It must contain an absolute Linux path, such as /mnt/large-drive/ollama-models. A relative path, a path that exists only for your login shell, or a path unavailable when the service starts will not give the systemd service a usable model store.

With the standard Linux system installation, Ollama’s documented default model location is /usr/share/ollama/.ollama/models. The systemd service normally runs as the dedicated ollama user, so that account—not just your personal login—needs read and write access to the new directory.

#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

A user who starts ollama serve manually can see a different location because that process inherits the launching user’s environment and home directory. This is why a manual server may use a user-home .ollama directory while the system service uses /usr/share/ollama/.ollama/models or the path in its service override.

Check the installation and choose a destination

Confirm that this procedure matches your installation

The steps below target a native Linux installation managed by systemd. They do not automatically configure Docker containers, distro packages with their own unit names, or custom launch scripts. Those installations need OLLAMA_MODELS added to their own container, unit, or launcher environment.

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

Before changing anything, identify which process is serving Ollama. If you use the system installation, use the ollama.service unit consistently. Do not start a second, unmanaged ollama serve process while testing; the two processes can inherit different environments and make a correct service setting appear ineffective.

Pick a filesystem that is available when Ollama starts

The destination can be another internal partition, a mounted external SSD, or another filesystem with enough capacity. Capacity alone is not sufficient: the mount must be present before the service starts, and the complete path must allow the service account to traverse its parent directories.

  • Use an absolute path, for example /mnt/large-drive/ollama-models.
  • Make sure the drive is mounted at that exact path after boot, not only in an interactive shell.
  • Leave enough free space for the models you expect to download.
  • Plan whether you will migrate the existing model files or pull them again.

Create the directory and assign ownership

Create the destination before editing the service and assign it to the account used by the standard installer:

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

The ownership command is important even when the directory was created by root. Without write access, Ollama can fail to create model blobs or manifests and the journal will show a permission error.

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

Set the model path persistently with systemd

A systemd service does not read the environment from your current terminal. Ollama’s official FAQ directs systemd users to set environment variables with systemctl. A drop-in override is persistent across reboots and package service restarts.

  1. Open the service override

    Run:

    sudo systemctl edit ollama.service

    Your editor opens a drop-in configuration for the service. If the command reports that the unit does not exist, your installation is not using this unit name; identify the unit supplied by your package or launcher instead of applying this file blindly.

    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
  2. Add the environment setting

    Enter the following exactly:

    [Service]
    Environment="OLLAMA_MODELS=/mnt/large-drive/ollama-models"

    Replace the example directory with the absolute destination you prepared. Keep the [Service] section and the Environment assignment together in the override. Save the file and exit the editor.

  3. Reload unit definitions

    Tell systemd to read the new drop-in:

    sudo systemctl daemon-reload

    This reloads unit configuration; it does not itself restart Ollama or move any model data.

    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.
  4. Restart Ollama

    Apply the new environment to the service process:

    sudo systemctl restart ollama

    The restarted service now looks in the configured directory. Existing files remain in the old directory until you migrate them or download them again.

Migrate models already downloaded

Changing OLLAMA_MODELS does not copy the old model store. Ollama’s model data includes blobs and manifests; both need to be present in the new model directory for previously downloaded models to appear.

Option 1: Copy the existing store

Copying first lets you verify the new location before deleting the original. Stop the service so it cannot change files while the copy is in progress:

sudo systemctl stop ollama
sudo cp -a /usr/share/ollama/.ollama/models/. /mnt/large-drive/ollama-models/
sudo chown -R ollama:ollama /mnt/large-drive/ollama-models
sudo systemctl start ollama

The -a option preserves file attributes during the copy. The source path above is the documented default for a standard system installation; if your original service was already configured with another path, substitute that path. The trailing . copies the contents, including the blobs and manifests directories, into the destination rather than adding an unintended extra parent directory.

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

After the service starts, verify the list of models. Keep the old copy until you are satisfied that the new service can read all required files and that the drive remains mounted reliably.

Option 2: Move the model directories

If you have sufficient backup protection and want to avoid temporarily storing two copies, move the existing blobs and manifests directories into the destination while preserving their ownership. Stop Ollama first, ensure the destination is empty or prepared for the move, and then start the service after checking the resulting layout. A move changes file locations but does not change the model metadata inside those directories.

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 3: Pull models again

You can leave the old files in place and pull each required model again after the path change. This is simplest when the old store is small or disposable, but it uses network bandwidth and local storage while the new copies are created. A model will not appear in ollama list merely because its files remain in the old directory.

Verify the new path

Check the service state

Inspect the unit immediately after the restart:

sudo systemctl status ollama

Look for an active service rather than a failed start. If the service is not running, read the unit journal:

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

Permission failures, an unavailable mount, and path-related errors are usually visible there. Correct the underlying issue, reload the unit if you changed its configuration, and restart the service again.

Check the model inventory

Run:

ollama list

Models copied or re-pulled into the configured directory should be listed. If the list is empty after a successful restart, first confirm that the destination contains both blobs and manifests, then check ownership and the service logs.

Pull a small known model if necessary

If you intentionally chose the re-download method, pull a small known model and run ollama list again. A successful pull confirms that the service can create files in the new directory. It also distinguishes a migration problem from a basic permissions or mount problem.

Why Ollama still uses the old directory

The variable was exported only in your shell

Running export OLLAMA_MODELS=/mnt/large-drive/ollama-models changes the environment of that shell and programs launched from it. It does not alter an already-running systemd service. Use the systemd override for the service, then run daemon-reload and restart it.

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

A second manual server is running

A manually started ollama serve can use a different environment from ollama.service. Requests may reach that unmanaged process instead of the service you edited, making the override look ignored. Stop the extra process and use one server process while testing. Check the systemd status and journal to confirm which process you are relying on.

The override was saved but not applied

Three actions are separate: saving the drop-in, running sudo systemctl daemon-reload, and restarting Ollama. Omitting either of the last two leaves the running process with its previous environment.

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 destination is inaccessible to the service account

Your login user may be able to list the directory while the ollama account cannot. Recheck ownership with:

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

Also check every parent directory in the path. The service account needs permission to traverse those directories as well as read and write the final model directory.

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

The drive was not mounted when the service started

If the path is on removable or separately mounted storage, systemd can start Ollama before that filesystem is available. The service then sees a missing or empty directory. Mount the filesystem at the configured path before starting Ollama and make the arrangement reliable across reboots. After the mount is available, restart the service and inspect journalctl -u ollama.

The files were not migrated

A successful configuration change can still produce an empty model list because the new directory contains no manifests. Copy or move the old blobs and manifests directories, or pull the models again. Do not assume that changing the variable performs a migration.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Persistent service setting versus a one-shell export

Approach How long it lasts Process identity Best use Migration needed
systemd drop-in with systemctl edit ollama.service Persists for the service until the override is changed or removed The system ollama service account Native Linux installations managed by systemd Move or re-pull existing models
Shell command export OLLAMA_MODELS=... Only for that shell and processes launched from it Your login user or the user launching ollama serve Testing a manually started server Move or re-pull models for that process’s model directory

The two approaches are not interchangeable. A shell export can be useful for a temporary test, but it will not configure the systemd service. Conversely, a service override does not change a separately launched process running under your login account.

Using an external or secondary drive

An external SSD or another larger mounted device supplies capacity; it does not automatically configure Ollama. You still need to set OLLAMA_MODELS, ensure the filesystem is mounted at boot or before the service starts, and grant the ollama account access.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use a stable mount point such as /mnt/large-drive, not a path that changes when removable media is reconnected.
  • Prepare the final model directory before restarting the service.
  • Test a reboot or an unmount/remount cycle before removing the original model store.
  • Keep the old model directory until ollama list and a test pull confirm that the new location works.

Changing the path again or reverting

To point Ollama somewhere else, run sudo systemctl edit ollama.service, change the OLLAMA_MODELS assignment to the new absolute directory, save it, run sudo systemctl daemon-reload, and restart the service. Migrate the model directories to the new destination before expecting old models to appear there.

To return to the documented default, remove the custom Environment assignment from the service drop-in, reload systemd, and restart Ollama. The default for the standard Linux system installation is /usr/share/ollama/.ollama/models. Any models stored only in the alternate directory remain there until you move them back or download them again.

Final checklist

  • Use an absolute destination in OLLAMA_MODELS.
  • For systemd, configure the variable with sudo systemctl edit ollama.service.
  • Run sudo systemctl daemon-reload after saving the override.
  • Restart with sudo systemctl restart ollama.
  • Make the destination readable and writable by ollama:ollama.
  • Ensure a separate drive is mounted before the service starts.
  • Copy or move both blobs and manifests, preserving ownership, or re-pull every model.
  • Use ollama list and journalctl -u ollama to verify the result.
  • Do not test with a second unmanaged ollama serve process.

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.