[GH-ISSUE #3441] Download/Archive and move models offline #48633

Closed
opened 2026-04-28 08:57:48 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @Solomin0 on GitHub (Apr 1, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3441

What are you trying to do?

I would like to be able to move ollama models between environments that are offline. There does not seem to be a supported official way to do this.

How should we solve this?

An ollama archive command would be great! Then the user could just ollama pull from the path the archive is saved in.

What is the impact of not solving this?

I am currently able to kinda work around by sending the ./ollama folder to a zip file on a machine that has internet access then copying it over. I must only do one model at a time or else the zips start to get impractical as I dont have a way to resolve multiple models.

I am worried about trying to import a new model into an existing environment as copying over the ./ollama folder seems sketchy as is.

Anything else?

Any advice or other workarounds would be appreciated. Thanks yall.

Originally created by @Solomin0 on GitHub (Apr 1, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3441 ### What are you trying to do? I would like to be able to move ollama models between environments that are offline. There does not seem to be a supported official way to do this. ### How should we solve this? An ollama archive command would be great! Then the user could just ollama pull from the path the archive is saved in. ### What is the impact of not solving this? I am currently able to kinda work around by sending the ./ollama folder to a zip file on a machine that has internet access then copying it over. I must only do one model at a time or else the zips start to get impractical as I dont have a way to resolve multiple models. I am worried about trying to import a new model into an existing environment as copying over the ./ollama folder seems sketchy as is. ### Anything else? Any advice or other workarounds would be appreciated. Thanks yall.
GiteaMirror added the question label 2026-04-28 08:57:48 -05:00
Author
Owner

@pdevine commented on GitHub (Apr 1, 2024):

Hey @Solomin0 , you should be able to just copy/tar/rsync the models/ directory and it will work. You need both the blobs/ and manifests/ directory. If you want to put the models in a different directory you can use the OLLAMA_MODELS env command when starting ollama serve.

This last part is covered in the FAQ. I'm wondering if we should add something to include how to copy the models?

<!-- gh-comment-id:2030594905 --> @pdevine commented on GitHub (Apr 1, 2024): Hey @Solomin0 , you should be able to just copy/tar/rsync the `models/` directory and it will work. You need both the `blobs/` and `manifests/` directory. If you want to put the models in a different directory you can use the `OLLAMA_MODELS` env command when starting `ollama serve`. This last part is covered in the [FAQ](https://github.com/ollama/ollama/blob/main/docs/faq.md#how-do-i-set-them-to-a-different-location). I'm wondering if we should add something to include how to copy the models?
Author
Owner

@Solomin0 commented on GitHub (Apr 2, 2024):

thanks @pdevine. When copying the blobs/manifests directories for model A I have that working fine. How could I go about introducing model B to the directories without overriding model A I guess is where I am struggling to maintain both.

<!-- gh-comment-id:2032306922 --> @Solomin0 commented on GitHub (Apr 2, 2024): thanks @pdevine. When copying the blobs/manifests directories for model A I have that working fine. How could I go about introducing model B to the directories without overriding model A I guess is where I am struggling to maintain both.
Author
Owner

@pdevine commented on GitHub (Apr 2, 2024):

You can copy them in; the blobs are content addressable (which is why they're called sha256-<hash>) so there's no chance that something bad will happen unless you have a corrupt file (you can check for this by running sha2 -256 on the blob and it should have the same sha256 hash as the file name).

What platform are you on? There are lots of tools (like tar) which make this really easy.

<!-- gh-comment-id:2032552500 --> @pdevine commented on GitHub (Apr 2, 2024): You can copy them in; the blobs are content addressable (which is why they're called `sha256-<hash>`) so there's no chance that something bad will happen unless you have a corrupt file (you can check for this by running `sha2 -256` on the blob and it should have the same sha256 hash as the file name). What platform are you on? There are lots of tools (like tar) which make this really easy.
Author
Owner

@Solomin0 commented on GitHub (Apr 3, 2024):

@pdevine I am working on linux. unpacking my tar
tar -xvf models/ollama_models/ollama_models_jan.tar.gz -C /root/.ollama
My understanding was that unpacking is destructive similar to cp but it seems more similar to mv is that correct?

<!-- gh-comment-id:2034841947 --> @Solomin0 commented on GitHub (Apr 3, 2024): @pdevine I am working on linux. unpacking my tar ```tar -xvf models/ollama_models/ollama_models_jan.tar.gz -C /root/.ollama``` My understanding was that unpacking is destructive similar to ```cp``` but it seems more similar to ```mv``` is that correct?
Author
Owner

@pdevine commented on GitHub (Apr 3, 2024):

@Solomin0 That should work fine. It won't blow away any files which weren't also in the tar archive when you're unpacking it, although it will overwrite anything if there is a name collision. With the blobs that won't matter because it will just overwrite with the exact same data.

<!-- gh-comment-id:2035180863 --> @pdevine commented on GitHub (Apr 3, 2024): @Solomin0 That should work fine. It won't blow away any files which weren't also in the tar archive when you're unpacking it, although it will overwrite anything if there is a name collision. With the blobs that won't matter because it will just overwrite with the exact same data.
Author
Owner

@Solomin0 commented on GitHub (Apr 3, 2024):

Great thanks!

<!-- gh-comment-id:2035429582 --> @Solomin0 commented on GitHub (Apr 3, 2024): Great thanks!
Author
Owner

@Solomin0 commented on GitHub (May 8, 2024):

Hey @pdevine I had to put this down for a bit but I am back and having issues. I am copying the models folder using
tar -czvf /workspace/outbox_tars/examplename_hash_size.tar.gz /models
Then i copy the tar from the initial docker container to my new one. In the new docker container I run the untar command
tar -xzvf examplename_hash_size.tar.gz -C /root/.ollama/

This looks like it works (it places in all the blob files and the manifest) but ollama list/ ollama run does not work and just returns a blank list. I am a bit stuck here any suggestions would be appreciated.

image

<!-- gh-comment-id:2101193982 --> @Solomin0 commented on GitHub (May 8, 2024): Hey @pdevine I had to put this down for a bit but I am back and having issues. I am copying the models folder using `tar -czvf /workspace/outbox_tars/examplename_hash_size.tar.gz /models` Then i copy the tar from the initial docker container to my new one. In the new docker container I run the untar command `tar -xzvf examplename_hash_size.tar.gz -C /root/.ollama/` This looks like it works (it places in all the blob files and the manifest) but ollama list/ ollama run does not work and just returns a blank list. I am a bit stuck here any suggestions would be appreciated. ![image](https://github.com/ollama/ollama/assets/37559666/c93761b9-7ddb-4c4a-93f0-923f69120702)
Author
Owner

@pdevine commented on GitHub (May 8, 2024):

@Solomin0 are you running off of main by any chance? This change just got merged which I think should fix that.

<!-- gh-comment-id:2101209663 --> @pdevine commented on GitHub (May 8, 2024): @Solomin0 are you running off of main by any chance? [This change](https://github.com/ollama/ollama/pull/4261) just got merged which I think should fix that.
Author
Owner

@Solomin0 commented on GitHub (May 10, 2024):

This was it thanks! I had just built my dockers a couple hours too early I guess lol.

<!-- gh-comment-id:2105108049 --> @Solomin0 commented on GitHub (May 10, 2024): This was it thanks! I had just built my dockers a couple hours too early I guess lol.
Author
Owner

@cgjosephlee commented on GitHub (Oct 21, 2024):

This might help if you want to transfer a specific model to offline server.
https://github.com/cgjosephlee/ollama-save-load

ollama pull gemma2:2b-instruct-q4_K_M
ollama list

export OLLAMA_MODELS="/path/to/ollama/models"  # change this if you have alternative path
./ollama-save.py gemma2:2b-instruct-q4_K_M | gzip > gemma2.tar.gz
./ollama-load.py gemma2.tar.gz
<!-- gh-comment-id:2425958623 --> @cgjosephlee commented on GitHub (Oct 21, 2024): This might help if you want to transfer a specific model to offline server. https://github.com/cgjosephlee/ollama-save-load ```sh ollama pull gemma2:2b-instruct-q4_K_M ollama list export OLLAMA_MODELS="/path/to/ollama/models" # change this if you have alternative path ./ollama-save.py gemma2:2b-instruct-q4_K_M | gzip > gemma2.tar.gz ./ollama-load.py gemma2.tar.gz ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#48633