{
  "slug": "short-write",
  "term": "Short write",
  "aliases": [
    "partial write"
  ],
  "definition": "A short write is a successful write operation that reports transferring a positive number of bytes smaller than the requested count.",
  "note": "The returned count identifies the completed prefix, not a durable application record. A later call for the remainder can fail. Documented causes include insufficient space on the medium, the RLIMIT_FSIZE limit and a signal arriving after at least one byte was written, while a signal before any byte yields EINTR. On Linux one call transfers at most 0x7ffff000 (2,147,479,552) bytes on 32-bit and 64-bit systems. [write-api]\n\nFor pipes, writes of up to PIPE_BUF bytes, which is 4096 bytes on Linux, are atomic. With O_NONBLOCK, a larger write to a pipe that is not full may transfer anywhere from 1 to n bytes. [pipe7]\n\nFor a privately owned replacement file, account for the accepted bytes before publishing it, because synchronization cannot supply bytes never submitted. For a shared append log, retrying the remainder alone avoids duplicating that prefix but does not prevent another writer from intervening between calls. These are protocol implications, not measured failure rates.",
  "advantages": [
    {
      "text": "Reporting the accepted prefix lets a caller resume at the exact byte position instead of resubmitting the whole buffer.",
      "citationIds": [
        "write-api"
      ]
    }
  ],
  "limitations": [
    "Not the same as a torn write after interruption.",
    "A direct-I/O error can follow partial modification; a negative return is not always proof of an unchanged range."
  ],
  "related": [
    "pwrite",
    "o-append",
    "o-dsync",
    "fsync",
    "torn-write",
    "writeback-error",
    "writev",
    "short-read"
  ],
  "citations": [
    {
      "id": "write-api",
      "title": "Linux man-pages 6.19: write(2), partial writes and errors",
      "url": "https://man7.org/linux/man-pages/man2/write.2.html",
      "accessed": "2026-10-23"
    },
    {
      "id": "hesela-publication",
      "title": "Hesela: Atomic rename is not a durable commit",
      "url": "https://hesela.com/analyses/atomic-rename-directory-durability/",
      "accessed": "2026-10-17"
    },
    {
      "id": "pipe7",
      "title": "Linux man-pages 6.19: pipe(7), PIPE_BUF and partial writes",
      "url": "https://man7.org/linux/man-pages/man7/pipe.7.html",
      "accessed": "2026-10-23"
    }
  ],
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-25",
  "provenance": [
    "write-api is the Linux man-pages 6.19 write(2) page, re-read for partial-write causes, signal handling and the per-call transfer limit.",
    "pipe7 is the Linux man-pages 6.19 pipe(7) page, read for PIPE_BUF atomicity and nonblocking partial writes.",
    "The errseq-t entry links here because a successful or partial write can still be followed by a writeback error reported later."
  ]
}
