How to Move Ollama Models to Another Drive (and Keep Your C Drive Happy!)
Running large language models locally is awesome, but they can eat up disk space faster than you can say “AI model.” If your C drive is starting to groan under the weight of Ollama’s models, it’s time to move them! At FutureFormDigital, we’re all about helping you manage your digital life efficiently, and that includes your AI tools. This guide will walk you through relocating Ollama’s application files and, more importantly, its massive model data to a different drive, freeing up precious space on your C drive.
Why Move Ollama’s Files?
Your C drive often has limited space, especially on laptops. Models for LLMs like Llama, Mistral, or Gemma can range from a few gigabytes to well over 70GB each. Moving them to a larger drive (like a D drive, or an external SSD) is a smart way to:
- Free up C drive space: Keep your OS and essential applications running smoothly.
- Improve performance: If your target drive is faster (e.g., an NVMe SSD), you might even see quicker model load times.
- Organize your storage: Keep your AI assets separate from your system files.
Ollama’s File Structure: What Are We Moving?
Before we start, it’s important to understand that Ollama has two main components to consider:
- The Ollama Application (Binaries): This is the core program files, like the
ollama.exefile and its dependencies. By default, on Windows, it usually installs under your user’sAppDatadirectory. - The Ollama Models: These are the actual AI models you download. By default, they are stored in a hidden folder within your user’s profile (
.ollamamodels).
Moving both of these is often the best approach to fully reclaim space on your C drive.
Method 1: Moving the Ollama Application (Reinstallation)
Unfortunately, Ollama’s Windows installer doesn’t offer a GUI option to select an installation directory. Directly moving the application files can break things. The recommended approach is to uninstall and then reinstall Ollama to your desired location.
Step 1: Uninstall Ollama
- Go to Windows Settings > Apps > Installed apps.
- Find “Ollama” in the list.
- Click on it and select Uninstall.
- Crucially: Do not manually delete the Ollama folders from
AppDataorProgram Filesat this stage, as the uninstaller handles necessary cleanup.
Step 2: Reinstall Ollama to Your Target Drive
- Download the latest Ollama installer (
OllamaSetup.exe) from the official Ollama website. - Open PowerShell or Command Prompt as an administrator (this is important for the
/DIRflag to work correctly with Program Files). - Navigate to where you downloaded the installer (e.g.,
cd D:Downloads). Run the installer using the
/DIRflag to specify your new location. For example, to install it on your D drive in a custom folder:Start-Process ".OllamaSetup.exe" -ArgumentList '/DIR="D:Program FilesOllama"' -WaitReplace
"D:Program FilesOllama"with your preferred installation path.
Step 3: Add the New Location to Your PATH Environment Variable
So you can run ollama commands from any terminal window without specifying the full path, you need to add the new installation directory to your system’s PATH.
- Open Environment Variables: Search for “Environment Variables” in Windows Search and click “Edit the system environment variables” or “Edit environment variables for your account.”
- Edit the PATH:
- Under “User variables” or “System variables” (depending on who you want to have access to it), find the
Pathvariable. - Click Edit.
- Click New and add the full path to your Ollama installation directory (e.g.,
D:Program FilesOllama).
- Under “User variables” or “System variables” (depending on who you want to have access to it), find the
- Apply Changes: Click OK on all windows to save the changes.
- Restart: Important: Close and re-open any PowerShell or Command Prompt windows for the PATH changes to take effect. You might even need to restart your computer for all services to recognize the updated PATH.
Step 4: Verify Application Installation
Open a new terminal window and try running:
ollama --version
Or, to be sure it’s picking up the correct executable:
Get-Command ollama
This should show the path to your new installation (e.g., D:Program FilesOllamaollama.exe).
Method 2: Moving Ollama Model Data
This is where the bulk of your disk space is being used. Ollama allows you to specify a different location for model storage using an environment variable.
Step 1: Create a New Models Directory
Choose a drive with ample space (e.g., your D drive) and create a new folder where you want Ollama models to be stored. For example:
D:OllamamodelsR:AI_Modelsollamamodels(as seen in some examples)
Step 2: Set the OLLAMA_MODELS Environment Variable
- Open Environment Variables: Again, search for “Environment Variables” and select “Edit environment variables for your account.”
- Create or Edit Variable:
- Under “User variables,” click New….
- Variable name:
OLLAMA_MODELS - Variable value: Enter the full path to the new folder you created in Step 1 (e.g.,
D:Ollamamodels). - Click OK to save.
- Apply Changes: Click OK on all windows.
Step 3: Restart Ollama
For the environment variable to be recognized, you need to restart the Ollama service or application.
- If running via Tray Icon: Right-click the Ollama icon in your system tray and select “Quit Ollama.” Then, relaunch it from your Start menu.
- If running
ollama serve: Stop theollama serveprocess (usually by pressingCtrl+Cin its terminal) and then restart it using theollama servecommand. - If running via Docker: This method applies if you’re running Ollama outside of Docker and want to control where its models are stored locally. If you’re using Docker, you manage model storage via Docker volumes, which is a different process.
Step 4: Verify Model Location
Open a new terminal window and run:
$env:OLLAMA_MODELS
This should display the path you just set. Now, try downloading a new model:
ollama pull llama3.1
Observe the download process. You should see it saving files in your newly specified OLLAMA_MODELS directory, not in your old C:Users<username>.ollamamodels folder.
Verification: Did It Work?
After following these steps, you should have:
- Ollama application installed on your D drive (or chosen location).
- Ollama model data stored on your D drive (or chosen location).
ollamacommands working from any terminal.- Your existing models (if any) accessible. If you moved the application and model data correctly, you should not need to re-download your models.
Troubleshooting Common Issues
ollamacommand not found:- Cause: The Ollama installation directory is not correctly added to your system’s PATH environment variable.
- Solution: Double-check the PATH variable in System Properties. Ensure the correct path (e.g.,
D:Program FilesOllama) is listed. Restart your terminal or computer.
Models disappeared after moving?
- Cause: Incorrect
OLLAMA_MODELSenvironment variable setting, or Ollama is still pointing to the old location. - Solution: Verify the
OLLAMA_MODELSvariable is set correctly in your user environment variables. Ensure you have restarted Ollama after setting it. If using Docker, ensure your volume mapping is correct.
- Cause: Incorrect
Ollama service won’t start:
- Cause: Potentially an incomplete uninstallation or lingering configuration issues.
- Solution: Ensure you followed the official uninstall procedure. Manually check and delete any remaining Ollama folders in
C:Users<User>AppDataLocalProgramsorC:Users<User>.ollama. Then, reinstall using the/DIRflag.
FutureFormDigital Insight: Proactive Storage Management
Moving Ollama’s application and model data is a fantastic way to manage your disk space effectively, especially if your C drive is a bit cramped. Our recommendation is to always plan your storage ahead of time. If you know you’ll be downloading large AI models, set up your OLLAMA_MODELS directory on a spacious drive from the start, or plan your move early before your C drive is completely full. This proactive approach minimizes hassle and keeps your AI experiments running smoothly.
Frequently Asked Questions (FAQ)
Q1: Can I just copy the
.ollamafolder to another drive and point Ollama to it?
A1: While you can copy the models, Ollama relies on theOLLAMA_MODELSenvironment variable to know where to look for them. Simply copying the folder and expecting it to work without setting the variable isn’t enough. It’s best to create the new folder first and then set the environment variable before downloading new models.Q2: Do I need to reinstall Ollama if I only want to move the models?
A2: No! If you only want to move the model data and keep the Ollama application on your C drive, you only need to set theOLLAMA_MODELSenvironment variable. The application itself can stay put.Q3: How do I move the Ollama application and its models to a new drive (e.g., D drive)?
A3: You’ll need to do both. First, uninstall Ollama, then reinstall it using the/DIRflag to specify the new application location on the D drive. Second, set theOLLAMA_MODELSenvironment variable to point to a new model storage location on the D drive (or another large drive).Q4: What happens to my existing models when I set the
OLLAMA_MODELSvariable?
A4: Ollama will continue to use the models in the old location until you restart it after setting the newOLLAMA_MODELSvariable. Once restarted, it will start looking for models in the new location. For any new models you download, they will go to the new location. You can then manually delete the old models from your C drive if you are sure they are no longer needed.Q5: I’m using Ollama in Docker. How do I move models to another drive?
A5: For Docker, you manage this through Docker volumes. You would typically create a new Docker volume that is mapped to a directory on your desired drive (e.g.,D:DockerVolumesollama-models:/root/.ollama). Then, when you run your Ollama container, you map this new volume. Existing models in the old volume would need to be copied over to the new volume’s location manually.Q6: Will moving Ollama slow down model loading?
A6: If you move models to a slower drive than your C drive, you might see a slight increase in model loading times. However, moving to a faster drive (like an NVMe SSD) could potentially speed things up.Q7: Is there a risk of losing my models during this process?
A7: The main risk comes from incorrect uninstallation or incorrect environment variable setup. By following the steps carefully, especially ensuring theOLLAMA_MODELSvariable is set correctly before downloading new models, and by using the/DIRflag for reinstallation, the risk is minimized. Always ensure yourOLLAMA_MODELSpath is correct and Ollama is restarted.Q8: How can I check if Ollama is using the correct directory for models?
A8: After restarting Ollama, check the$env:OLLAMA_MODELSvariable in PowerShell. Then, try downloading a new model (ollama pull <model_name>) and monitor where the files are being saved.Q9: What if I want to move Ollama on Linux?
A9: On Linux, you typically edit the Ollama systemd service file (/etc/systemd/system/ollama.serviceor viasudo systemctl edit ollama.service) and addEnvironment="OLLAMA_MODELS=/path/to/your/models"under the[Service]section. You also need to ensure theollamauser has permissions to the new directory.Q10: Can I install Ollama on a different drive without reinstalling?
A10: No, for the Ollama application itself on Windows, reinstallation with the/DIRflag is the recommended method due to how the installer registers paths and services. Model data, however, can be relocated without reinstalling the application by using theOLLAMA_MODELSenvironment variable.
Wrapping Up
Managing disk space is a key part of maintaining a streamlined digital workflow. By relocating Ollama’s application files and its massive model data, you can keep your C drive lean and your AI projects running smoothly. It might seem a bit technical, but by following these steps carefully, you’ll gain better control over your system’s storage.
So, what’s your biggest challenge when managing large AI models locally? Are you running out of space, or do you have a clever storage strategy we should know about? Share your thoughts and tips in the comments below – let’s help each other build more resilient digital setups!