Fix tar that runs out of space
We'll check free space with df -h, size the archive with du -sh, choose the right extraction path, and free space before retrying.
What you'll need
- SSH or console access
- Enough free space on target filesystem (or ability to free it)
Step-by-step diagnostic
Quick triage — pick your path
Get started
Choose the option that matches what you see. You can jump straight to that section.
Show full guide
Steps
Goal: Check free space, size the archive, choose the right extraction path, and free space if needed.
- Run
df -hto confirm which filesystem is full. Tar extracts to the current directory unless you use-C. - Good: You know which mount is full. Proceed to Check space and archive size.
- Bad: If df shows space but extraction fails, run
df -ifor inodes—see fix-linux-runs-out-of-disk.
Check space and archive size
Goal: Confirm how much space you need.
- Run
du -sh archive.tarordu -sh archive.tar.gz. Compressed archives expand—plan for 2–5x the .tar.gz size. - Run
df -hon the target filesystem. Compare free space to archive size. - Good: You know the archive size and free space. Proceed to Choose extraction path.
- Bad: Not enough space—free space or extract elsewhere.
Choose extraction path
Goal: Extract to a filesystem with enough space.
- Tar extracts to the current directory by default. Use
tar -xf archive.tar -C /path/to/destto extract elsewhere. - When
/is full, extract to/tmp,/home, or another mount. See fix-disk-shows-full-but-is-not if space appears free but writes fail. - Good: The extraction path has enough space. Extraction completes.
- Bad: Free space first—see fix-linux-runs-out-of-disk, fix-log-fills-disk.
When to escalate
Escalate if:
- You cannot free enough space.
- The target is a critical partition (e.g. root).
- You need to expand the filesystem or add storage.
Provide df -h, df -i, du -sh of the archive, and the extraction path used.
Verification
df -hshows free space on the target filesystem before extraction.tar -xfcompletes without “No space left on device”.- Extracted files are present;
lsanddu -shconfirm the content.
Escalation ladder
Work from the device outward. Stop when the problem is fixed.
- Check space Run df -h and du -sh on the archive.
- Choose extraction path Extract to a mount with enough space (-C /path).
- Free space Clear logs, cache, temp; see fix-linux-runs-out-of-disk.
- Check inodes df -i; clean dirs with many small files.
- Escalate Provide df -h, df -i, du -sh; consider expand or add storage.
What to capture if you need help
Before calling support or posting for help, have these ready. It speeds everything up.
- df -h output
- df -i output
- du -sh of archive
- Extraction path used
- Steps already tried
Does tar fail with "No space left on device"?
Tar extracts to current directory by default. The target filesystem is full.
You can change your answer later.
How big is the archive?
du -sh archive.tar. Compressed archives expand 2–5x.
You can change your answer later.
Is the extraction path on a full filesystem?
tar -C /path extracts to that path. Default is current directory.
You can change your answer later.
Free space and retry
Done
Reviewed by Blackbox Atlas
Frequently asked questions
- Why does tar run out of space?
- The extraction path (current directory by default) is on a full filesystem. Tar needs roughly the compressed size or more (often 2–5x for compressed archives). Check df -h before extracting.
- How do I check space before extracting?
- Run df -h to see free space. Run du -sh archive.tar to see archive size. Compressed archives expand—plan for 2–5x the .tar.gz size. Extract to a mount with enough space.
- When should I escalate tar space failures?
- Escalate if you cannot free space, the archive is on a critical partition, or you need to expand the filesystem. Provide df -h, df -i, and du -sh output.
Rate this guide
Was this helpful?
Thanks for your feedback.