November 2, 2024

How to Find Where Ollama Stores Downloaded LLM Models on Linux Systems?

In this Large Language Models (LLMs) tutorial, we explain how to find where Ollama stores downloaded LLM models on Linux Systems. The YouTube tutorial accompanying this Ollama tutorial is given below.

If you want to inspect the downloaded models, or if you want to properly uninstall Ollama it is very important to know where Ollama stores the models on the local computer. Ollama stores models in the /models folder that contains these two subfolders

– Model blobs – these are large files that store the model parameters and data of a model. They are stored as blobs so that they can be reused between models that share various prompts.

– Manifests – these are files that contain metadata and other files that specify the architecture and configuration of the model.

The main issue is how to find these folders and corresponding files.

When you run for example

ollama run llama3.1:8b
ollama run llama3.1:latest

or

ollama run llama3.1:8b
ollama pull llama3.1:llama3.1:latest

Model files will be stored in the default folders. Let us find out where these folders are. First make sure that plocate search tool is installed. We can install this tools as follows

sudo apt install plocate
sudo updatedb

Then, let us search for ollama

plocate ollama

The output will look like this:

/var/snap/ollama/common/models
/var/snap/ollama/common/models/blobs
/var/snap/ollama/common/models/manifests
/var/snap/ollama/common/models/blobs/sha256-0ba8f0e314b4264dfd19df045cde9d4c394a52474bf92ed6a3de22a4ca31a177
/var/snap/ollama/common/models/blobs/sha256-11ce4ee3e170f6adebac9a991c22e22ab3f8530e154ee669954c4bc73061c258
/var/snap/ollama/common/models/blobs/sha256-1a4c3c319823fdabddb22479d0b10820a7a39fe49e45c40bae28fbe83926dc14
/var/snap/ollama/common/models/blobs/sha256-56bb8bd477a519ffa694fc449c2413c6f0e1d3b1c88fa7e3c9d88d3ae49d4dcb
/var/snap/ollama/common/models/blobs/sha256-8eeb52dfb3bb9aefdf9d1ef24b3bdbcfbe82238798c4b918278320b6fcef18fe
/var/snap/ollama/common/models/manifests/registry.ollama.ai
/var/snap/ollama/common/models/manifests/registry.ollama.ai/library
/var/snap/ollama/common/models/manifests/registry.ollama.ai/library/llama3.1
/var/snap/ollama/common/models/manifests/registry.ollama.ai/library/llama3.1/8b
/var/snap/ollama/common/models/manifests/registry.ollama.ai/library/llama3.1/latest

From here, we can further filter the results as follows

plocate ollama | grep -w models

The output looks like this:

/var/snap/ollama/common/models
/var/snap/ollama/common/models/blobs
/var/snap/ollama/common/models/manifests
/var/snap/ollama/common/models/blobs/sha256-0ba8f0e314b4264dfd19df045cde9d4c394a52474bf92ed6a3de22a4ca31a177
/var/snap/ollama/common/models/blobs/sha256-11ce4ee3e170f6adebac9a991c22e22ab3f8530e154ee669954c4bc73061c258
/var/snap/ollama/common/models/blobs/sha256-1a4c3c319823fdabddb22479d0b10820a7a39fe49e45c40bae28fbe83926dc14
/var/snap/ollama/common/models/blobs/sha256-56bb8bd477a519ffa694fc449c2413c6f0e1d3b1c88fa7e3c9d88d3ae49d4dcb
/var/snap/ollama/common/models/blobs/sha256-8eeb52dfb3bb9aefdf9d1ef24b3bdbcfbe82238798c4b918278320b6fcef18fe
/var/snap/ollama/common/models/manifests/registry.ollama.ai
/var/snap/ollama/common/models/manifests/registry.ollama.ai/library
/var/snap/ollama/common/models/manifests/registry.ollama.ai/library/llama3.1
/var/snap/ollama/common/models/manifests/registry.ollama.ai/library/llama3.1/8b
/var/snap/ollama/common/models/manifests/registry.ollama.ai/library/llama3.1/latest

From here, we can that models are stored here

/var/snap/ollama/common/models/
ls -la

There, we have two folders:

total 24
drwxr-xr-x 4 root root  4096 Aug  8 15:39 .
drwxr-xr-x 3 root root  4096 Jul 26 12:13 ..
drwxr-xr-x 2 root root 12288 Aug  8 15:41 blobs
drwxr-xr-x 3 root root  4096 Aug  8 15:41 manifests

These are the folders storing blobs and manifests. That is, these are the folders that store the models. We can visually inspect these models by running Nautilus file explorer from the command line (in the same folder as the folder that contains blobs and manifests subfolders)

nautilus .