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.

Category
Troubleshooting · Servers & Linux
Time
10–25 min
Last reviewed
What you'll need
  • SSH or console access
  • Enough free space on target filesystem (or ability to free it)

Step-by-step diagnostic

Step 1 of 5
Show full guide

Steps

Goal: Check free space, size the archive, choose the right extraction path, and free space if needed.

  • Run df -h to 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 -i for inodes—see fix-linux-runs-out-of-disk.

Check space and archive size

Goal: Confirm how much space you need.

  • Run du -sh archive.tar or du -sh archive.tar.gz. Compressed archives expand—plan for 2–5x the .tar.gz size.
  • Run df -h on 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/dest to 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 -h shows free space on the target filesystem before extraction.
  • tar -xf completes without “No space left on device”.
  • Extracted files are present; ls and du -sh confirm the content.

Escalation ladder

Work from the device outward. Stop when the problem is fixed.

  1. Check space Run df -h and du -sh on the archive.
  2. Choose extraction path Extract to a mount with enough space (-C /path).
  3. Free space Clear logs, cache, temp; see fix-linux-runs-out-of-disk.
  4. Check inodes df -i; clean dirs with many small files.
  5. 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.

Run `df -h`. Check which mount is full. Yes: Proceed to check archive size and extraction path. No: Different error—check tar output.

You can change your answer later.

How big is the archive?

du -sh archive.tar. Compressed archives expand 2–5x.

Run `du -sh archive.tar` or `du -sh archive.tar.gz`. Compare to `df -h` free space. Need more: Free space or extract to another mount. Enough: Check extraction path.

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.

Check where you are extracting. Use `tar -xf archive.tar -C /path/to/dest` to extract to a mount with space. Good: Extraction completes. Bad: Free space or choose another mount.

You can change your answer later.

Free space and retry

Clear logs (journalctl --vacuum-size=100M), package cache (apt clean, dnf clean), temp files. Or extract to /tmp, /home, or another disk. See fix-linux-runs-out-of-disk, fix-disk-shows-full-but-is-not, fix-log-fills-disk.

Done

Extraction completes. Monitor with df -h.

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.

Continue to