How to change the model storage path in Ollama

Last update: 25/07/2026

  • Disk space management is critical when running local LLMs due to the large size of the weight files.
  • The configuration is primarily based on the use of the OLLAMA_MODELS environment variable depending on the operating system.
  • It is possible to migrate already downloaded models by physically moving the folders before applying the path changes.

How to change the folder where Ollama saves the models

How do I change the folder where Ollama saves models? If you've ventured into running language models on your own computer, you'll have noticed that Ollama is a fantastic tool for simplifying the whole process. However, there's a small drawback that often surfaces quickly: disk spaceBy default, the program tends to save the models on the drive where the operating system is located, and as we know, those files can weigh tens of gigabytes, filling up your main SSD in no time.

Moving these files to a secondary drive or a partition with more space is one of the first optimizations we should make to prevent the PC from freezing or being unable to download that 70B model we're so keen on. To do this, you don't need to be a computer expert; you just need to adjust a couple of variables and restart the service so that Ollama knows exactly where to look for her treasures.

Install Ollama on Windows
Related article:
How to install and configure Ollama on Windows to use local AI

Default locations based on your system

Before moving anything, it's essential to know where the models are currently "hiding." WindowsYou'll usually find them in C:\Users\TU_USUARIO\.ollama\models. If you use macOSthe route is usually ~/.ollama/modelsIn the case of LinuxThe situation varies depending on how you installed it: if it was through the official service script, they're probably in /usr/share/ollama/.ollama/models, although in manual installations they usually remain in the user's home folder.

Exclusive content - Click Here  How to verify file integrity with Paragon Backup & Recovery Home?

Configuration in Windows environments

Connect AnythingLLM with Ollama

If you use Windows, you have several ways to approach this. The most recommended is through the system environment variablesTo do this, you must search in the Start menu for "Edit system environment variables" and enter the variables section. This is where you must create a new variable called OLLAMA_MODELS and assign it the full path of your secondary disk as its value, for example, D:\OllamaModelsIt is vital that the folder already exists before taking this step.

How to delete downloaded models without breaking LM Studio
Related article:
How to change the model folder in LM Studio and optimize its use

If you already have downloaded templates and don't want to download them again from scratch, you can do a manual migrationFirst, close Ollam completely (make sure there are no active processes in Task Manager). Then, cut the folder .ollama from your user account and paste it into the new destination. Once this is done, configure the environment variable mentioned above and restart the server so that it recognizes the new location.

For the bravest among us who prefer the console, it is possible to install Ollama in a specific path from the beginning using the command OllamaSetup.exe /DIR="D:\OllamaDir"which allows both the application and the models reside outside of Unit C.

Detailed settings for Linux users

How to organize conversations using folders in Open WebUI

On Linux, management depends entirely on whether you run Ollama as a normal user or as a system service. If you installed it using the official script, the cleanest approach is to edit the configuration of systemdRunning sudo systemctl edit ollama.serviceYou can add a line under the section that says Environment="OLLAMA_MODELS=/ruta/especial/ollama/models"After saving, don't forget to run sudo systemctl daemon-reload and restart the service with sudo systemctl restart ollama.

Ollam is going slowly
Related article:
How to speed up Ollama: A complete guide to optimizing your local AI

If you prefer a more manual installation or run the server directly in the terminal, you can add the line export OLLAMA_MODELS=/tu/ruta/personalizada to your file .bashrc o .zshrcThis will make the settings permanent every time you open a session. One important detail is monitor deed permitsThe user running Ollama must have full control over the new folder to avoid download errors.

Exclusive content - Click Here  Switch 2 bans for secondhand games and MIG cartridges: what's going on

Be careful if you decide to use a partition. NTFS format in LinuxThis is because it has been reported that loading models can become considerably slower, resulting in a loss of more than 20% of performance compared to native formats such as EXT4.

Procedure for macOS users

On Macs, the variable to adjust is the same, but the way to apply it changes. If you need a temporary change to last only until the next reboot, you can use the terminal with the command launchctl setenv OLLAMA_MODELS /ruta/al/disco/externoThis is ideal for performing quick tests without altering the global system configuration.

LM Studio vs Ollama
Related article:
Which local AI performs better on modest PCs: LM Studio vs. Ollama

To make the change permanent, it's best to edit your shell's configuration file (usually ~/.zshrc) adding the line export OLLAMA_MODELS="/Users/tuusuario/modelos"Once saved, run source ~/.zshrc y Restart the Ollama application from the menu bar icon for the changes to take effect.

Using Docker and volume mounts

For those who prefer clean containers, Docker is the ideal option. To prevent models from being deleted when removing the container, it is mandatory to use persistent volumesWhen throwing the container, the flag must be used. -v ollama_data:/root/.ollamaIf you want the data to go to a specific folder on your hard drive, simply change the volume name to an absolute path on your host system.

Exclusive content - Click Here  How to Change Mouse Color

Additionally, you can pass additional environment variables using the flag -eallowing you to configure the OLLAMA_HOST para exponer la API en tu red local o ajustar el OLLAMA_KEEP_ALIVE para decidir cuánto tiempo permanece el modelo en VRAM antes de descargarse, optimizando así la memoria de tu GPU.

Troubleshooting and optimization

Sometimes, even after configuring everything, Ollama continues to write to the main drive. In these cases, check that the variable is a system variable and not a temporary user account. If you encounter the error of address already in use On port 11434, you likely have a ghost instance running; use netstat o lsof to locate the process and kill it before restarting.

If you notice that performance has decreased, check with the command ollama ps that the indicated processor is GPU and not CPU. If the model has been moved to a mechanical hard drive (HDD) instead of an SSD, it's normal for the initial load time to be much longer, although once the model is in RAM or VRAM, the text generation speed will not be affected. If you need to free up more space, remember How to delete models you no longer use in Ollama.

Properly configuring the model path using the OLLAMA_MODELS environment variable frees up critical space on the system drive and organizes the LLM library on larger disks, ensuring that the local infrastructure is scalable and efficient regardless of whether Windows, Linux, macOS, or Docker containers are used.

How to limit the RAM used by Ollama
Related article:
How to optimize and limit memory usage in Ollama
Cristian Garcia

Cristian Garcia

Passionate about technology since he was little. I love being up to date in the sector and, above all, communicating it. That is why I have been dedicated to communication on technology and video game websites for many years. You can find me writing about Android, Windows, MacOS, iOS, Nintendo or any other related topic that comes to mind.