vitamin Cho
vitamin Cho

Reputation: 55

How to re-link already downloaded ollama model files to ollama

I am building a codellama using ollama in an environment where the internet is blocked due to some circumstances.

Due to a misconfiguration, ollama is not recognizing the models I previously downloaded when internet was allowed.

However, given its massive disk usage, it seems likely that the downloaded model can be recycled.

The /usr/share/ollama folder is using up a huge amount of space.

v100@v100-VM:/usr/share/ollama$ sudo du -h
4.0K    ./.nv/ComputeCache
8.0K    ./.nv
163G    ./.ollama/models/blobs
28K ./.ollama/models/manifests/registry.ollama.ai/library/qwen2.5-coder
16K ./.ollama/models/manifests/registry.ollama.ai/library/exaone3.5
12K ./.ollama/models/manifests/registry.ollama.ai/library/llama3.3
20K ./.ollama/models/manifests/registry.ollama.ai/library/codellama
80K ./.ollama/models/manifests/registry.ollama.ai/library
84K ./.ollama/models/manifests/registry.ollama.ai
88K ./.ollama/models/manifests
163G    ./.ollama/models
163G    ./.ollama
163G    .

I'm looking for a way to reconnect this to ollama.

Thanks in advance for your help.

Upvotes: 1

Views: 69

Answers (1)

Nikita Robert
Nikita Robert

Reputation: 9

If you've already downloaded Ollama model files but need to re-link them to Ollama (e.g., after reinstalling, moving them, or using a new system), follow these steps:

  1. Locate Your Existing Model Files Ollama stores model files in the following default directories:

Linux/macOS: ~/.ollama/models Windows: C:\Users\YourUsername.ollama\models

If you've moved or backed up the model files, ensure they are in this directory.

  1. Verify Ollama’s Model Directory To check where Ollama is currently looking for models, run:

sh Copy Edit ollama show <model_name>

If it doesn't find the model, you may need to set the correct directory.

  1. Manually Move or Link Models If your models are in another directory, move them to the correct location. Alternatively, create a symbolic link: Linux/macOS: sh Copy Edit ln -s /path/to/your/models ~/.ollama/models

Windows (Command Prompt): cmd Copy Edit mklink /D C:\Users\YourUsername.ollama\models "D:\path\to\your\models"

  1. Rebuild the Model Index If Ollama still doesn't recognize the models, rebuild the index:

sh Copy Edit ollama pull <model_name>

If the model is already in the directory, this should detect and use it without re-downloading. If necessary, manually rename the model files to match the expected names.

  1. Restart Ollama Restart the Ollama service or your system to ensure it picks up the changes.

After this, you should be able to use your models without downloading them again. Let me know if you need further details! 🚀

Upvotes: 0

Related Questions