[PR #15218] server: check available disk space before model download #25624

Open
opened 2026-04-19 18:19:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15218
Author: @dhirajlochib
Created: 4/2/2026
Status: 🔄 Open

Base: mainHead: server/check-disk-space-before-pull


📝 Commits (3)

  • 6d65b60 server: check available disk space before model download
  • 5dd23eb server: suppress unconvert lint for cross-platform Bsize type
  • 5e53105 server: split diskspace into platform files to avoid lint conflicts

📊 Changes

5 files changed (+84 additions, -0 deletions)

View changed files

server/diskspace_darwin.go (+13 -0)
server/diskspace_test.go (+16 -0)
server/diskspace_unix.go (+15 -0)
server/diskspace_windows.go (+19 -0)
📝 server/images.go (+21 -0)

📄 Description

Closes #14255

Before downloading model blobs, check that the destination filesystem has enough free space. Already-cached layers are excluded from the required-space calculation so a resumed or re-pull doesn't fail unnecessarily.

If space is insufficient the pull is aborted immediately with a clear error:

Error: not enough disk space: need 4.7 GB, have 1.2 GB

Implementation:

  • server/diskspace_unix.go — uses syscall.Statfs (Linux/macOS)
  • server/diskspace_windows.go — uses windows.GetDiskFreeSpaceEx
  • Check is inserted in PullModel after the manifest is fetched and before any blobs are downloaded
  • The check is best-effort: errors from availableBytes are silently ignored so unusual filesystems do not block downloads

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15218 **Author:** [@dhirajlochib](https://github.com/dhirajlochib) **Created:** 4/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `server/check-disk-space-before-pull` --- ### 📝 Commits (3) - [`6d65b60`](https://github.com/ollama/ollama/commit/6d65b600e9f8dea9a9420a274c0d9994220a96a0) server: check available disk space before model download - [`5dd23eb`](https://github.com/ollama/ollama/commit/5dd23eb594e378fe257025a4c6475140406a3e19) server: suppress unconvert lint for cross-platform Bsize type - [`5e53105`](https://github.com/ollama/ollama/commit/5e531052c8512e2cb219c409daf4e8c31afcf210) server: split diskspace into platform files to avoid lint conflicts ### 📊 Changes **5 files changed** (+84 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `server/diskspace_darwin.go` (+13 -0) ➕ `server/diskspace_test.go` (+16 -0) ➕ `server/diskspace_unix.go` (+15 -0) ➕ `server/diskspace_windows.go` (+19 -0) 📝 `server/images.go` (+21 -0) </details> ### 📄 Description Closes #14255 Before downloading model blobs, check that the destination filesystem has enough free space. Already-cached layers are excluded from the required-space calculation so a resumed or re-pull doesn't fail unnecessarily. If space is insufficient the pull is aborted immediately with a clear error: ``` Error: not enough disk space: need 4.7 GB, have 1.2 GB ``` **Implementation:** - `server/diskspace_unix.go` — uses `syscall.Statfs` (Linux/macOS) - `server/diskspace_windows.go` — uses `windows.GetDiskFreeSpaceEx` - Check is inserted in `PullModel` after the manifest is fetched and before any blobs are downloaded - The check is best-effort: errors from `availableBytes` are silently ignored so unusual filesystems do not block downloads --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 18:19:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#25624