[GH-ISSUE #2571] Storing models on external drive #1510

Closed
opened 2026-04-12 11:25:22 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @shersoni610 on GitHub (Feb 18, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2571

Originally assigned to: @dhiltgen on GitHub.

Hello,

I have limited memory on the OS hard drive. So I want to store all the models
in /usr/share/ollama/.ollama/models/blobs on an external drive. After downloading
the models, I made a softlink as:

sudo ln -s ~/Disk2/Models/Ollama/blob /usr/share/ollama/.ollama/models/blobs

but when I rurn the code, I get the message:

Error: mkdir /usr/share/ollama/.ollama/models/blobs: file exists

I do not understand why ollama i trying to perform "mkdir". Can someone help?

Originally created by @shersoni610 on GitHub (Feb 18, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2571 Originally assigned to: @dhiltgen on GitHub. Hello, I have limited memory on the OS hard drive. So I want to store all the models in /usr/share/ollama/.ollama/models/blobs on an external drive. After downloading the models, I made a softlink as: sudo ln -s ~/Disk2/Models/Ollama/blob /usr/share/ollama/.ollama/models/blobs but when I rurn the code, I get the message: Error: mkdir /usr/share/ollama/.ollama/models/blobs: file exists I do not understand why ollama i trying to perform "mkdir". Can someone help?
GiteaMirror added the question label 2026-04-12 11:25:22 -05:00
Author
Owner

@Natfan commented on GitHub (Feb 21, 2024):

Consider setting the OLLAMA_MODELS environment variable to point to the location of your model files. This should remove issue caused by symlinking across physical drives.

<!-- gh-comment-id:1957979986 --> @Natfan commented on GitHub (Feb 21, 2024): Consider setting the `OLLAMA_MODELS` environment variable to point to the location of your model files. This should remove issue caused by symlinking across physical drives.
Author
Owner

@dhiltgen commented on GitHub (Feb 26, 2024):

Please refer to https://github.com/ollama/ollama/blob/main/docs/faq.md#where-are-models-stored for adjusting where models are stored.

<!-- gh-comment-id:1964963680 --> @dhiltgen commented on GitHub (Feb 26, 2024): Please refer to https://github.com/ollama/ollama/blob/main/docs/faq.md#where-are-models-stored for adjusting where models are stored.
Author
Owner

@34r7h commented on GitHub (Mar 25, 2024):

i'm using red hat. according to the docs, is it as simple as adding export OLLAMA_MODELS=/home/models to bashrc?

i did that and checked it's set in a new terminal but ollama is still using the original location to save models. Is there another step?

<!-- gh-comment-id:2018966442 --> @34r7h commented on GitHub (Mar 25, 2024): i'm using red hat. according to the docs, is it as simple as adding `export OLLAMA_MODELS=/home/models` to bashrc? i did that and checked it's set in a new terminal but ollama is still using the original location to save models. Is there another step?
Author
Owner

@dhiltgen commented on GitHub (Mar 27, 2024):

@34r7h ollama is a client-server architecture, so that setting is needed on the server. If you installed using our install script, it set up a systemd init config, which you would need to update to include that variable. See this section of the faq for detailed instructions.

<!-- gh-comment-id:2023841001 --> @dhiltgen commented on GitHub (Mar 27, 2024): @34r7h ollama is a client-server architecture, so that setting is needed on the server. If you installed using our install script, it set up a systemd init config, which you would need to update to include that variable. See [this section](https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-linux) of the faq for detailed instructions.
Author
Owner

@theaidran commented on GitHub (Jun 23, 2024):

You can change HOME variable. As if ollama models as default are stored in ~/.ollama/models
Before installing ollama simply change HOME variable.
In Python for eg:
import os
os.environ['HOME'] = '/content/MyDrive'

<!-- gh-comment-id:2184983003 --> @theaidran commented on GitHub (Jun 23, 2024): You can change HOME variable. As if ollama models as default are stored in ~/.ollama/models Before installing ollama simply change HOME variable. In Python for eg: import os os.environ['HOME'] = '/content/MyDrive'
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1510