Skip to content
Latchkey

tar Write Error: No Space Left on Device (CI)

A tar write error almost always means the target filesystem ran out of space mid-write.

Disk-full failures are common in CI because runners have modest, shared disks. tar reports them as write errors, and the fix is freeing space, not changing flags.

What it does

When the filesystem holding the output archive (or the extraction target) fills up, the underlying write() call fails with ENOSPC and tar reports a write error, then exits non-zero. The same happens to compressors in the pipeline (gzip, zstd), which report their own no-space errors.

Common usage

Terminal
df -h .                       # check free space first
docker system prune -af       # reclaim space from images/layers
rm -rf /tmp/* ~/.cache/*       # clear caches
tar -czf - dir/ | ssh host 'cat > backup.tgz'   # avoid local disk

Error messages

MessageMeaning
tar: out.tar: Cannot write: No space left on deviceOutput disk is full
tar: Error is not recoverable: exiting nowFatal write failure, archive incomplete
gzip: stdout: No space left on deviceCompressor ran out of space
zstd: error 70 : Write error : No space left on devicezstd output disk full
tar: Cannot write: Broken pipeDownstream consumer died (often after its disk filled)

In CI

Hosted runners start with limited free disk and large toolchains. Before a big packaging or cache step, run df -h and reclaim space: docker system prune -af, delete unused language SDKs, or clear ~/.cache. Streaming the archive off-box with | ssh avoids writing it to the runner disk at all.

Common errors in CI

Any No space left on device from tar, gzip, or zstd means the destination is full, not that the command is wrong. The archive left behind is truncated and will later fail extraction with tar: Unexpected EOF in archive. Free space and re-run; do not trust a partial archive produced by a failed write.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →