[GH-ISSUE #14255] Check usable disk space before downloading a model #71341

Open
opened 2026-05-05 01:16:26 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @sboden on GitHub (Feb 14, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/14255

My use case:

ollama pull qwen3:14b
pulling manifest
pulling a8cc1361f314:  67% ▕██████████████████████████████████████                    ▏ 6.2 GB/9.3 GB   11 MB/s   4m28s
Error: write /usr/share/ollama/.ollama/models/blobs/sha256-a8cc1361f3145dc01f6d77c6c82c9116b9ffe3c97b34716fe20418455876c40e-partial: no space left on device

It would be nice if ollama could check disk space upfront and complain when not enough disk space is available.
2 ways:
a) Programmatically check the the available disk space on the file system the blobs are written to, and complain if not enough disk space is available.
b) Figure out the size of the model to download, create an scratch file of that size. Then download the model overwriting the scratch file. This makes sure the diskspace is still available while downloading the model.

Originally created by @sboden on GitHub (Feb 14, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/14255 My use case: ``` ollama pull qwen3:14b pulling manifest pulling a8cc1361f314: 67% ▕██████████████████████████████████████ ▏ 6.2 GB/9.3 GB 11 MB/s 4m28s Error: write /usr/share/ollama/.ollama/models/blobs/sha256-a8cc1361f3145dc01f6d77c6c82c9116b9ffe3c97b34716fe20418455876c40e-partial: no space left on device ``` It would be nice if ollama could check disk space upfront and complain when not enough disk space is available. 2 ways: a) Programmatically check the the available disk space on the file system the blobs are written to, and complain if not enough disk space is available. b) Figure out the size of the model to download, create an scratch file of that size. Then download the model overwriting the scratch file. This makes sure the diskspace is still available while downloading the model.
GiteaMirror added the feature request label 2026-05-05 01:16:26 -05:00
Author
Owner

@dhirajlochib commented on GitHub (Apr 2, 2026):

Implemented in PR #15218.

Added a pre-download disk space check in PullModel (server/images.go):

  1. After fetching the manifest, iterate all layers and skip those already cached on disk
  2. Sum the sizes of missing layers
  3. Get free space on the blobs directory via syscall.Statfs (Unix) / windows.GetDiskFreeSpaceEx (Windows) in new platform-specific files diskspace_unix.go / diskspace_windows.go
  4. Return a human-readable error if space is insufficient (e.g. not enough disk space: need 4.7 GB, have 1.2 GB)

Errors from the space check are silently ignored so unusual filesystems won't block downloads.

<!-- gh-comment-id:4178495865 --> @dhirajlochib commented on GitHub (Apr 2, 2026): Implemented in PR #15218. Added a pre-download disk space check in `PullModel` (`server/images.go`): 1. After fetching the manifest, iterate all layers and skip those already cached on disk 2. Sum the sizes of missing layers 3. Get free space on the blobs directory via `syscall.Statfs` (Unix) / `windows.GetDiskFreeSpaceEx` (Windows) in new platform-specific files `diskspace_unix.go` / `diskspace_windows.go` 4. Return a human-readable error if space is insufficient (e.g. `not enough disk space: need 4.7 GB, have 1.2 GB`) Errors from the space check are silently ignored so unusual filesystems won't block downloads.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#71341