What Happens When Unrar Exceeds Disk Quota
When the unrar utility attempts to extract an archive
that exceeds a user's disk quota, the extraction process halts
immediately with a write error, leaving an incomplete, corrupted file on
the filesystem and returning a non-zero exit status. This article
explains the technical failure mechanism during the extraction, the
expected error messages, the resulting state of the target files, and
how to resolve the error.
The System-Level Failure Mechanism
Disk quotas on Unix and Linux systems are enforced at the kernel
level. As unrar extracts compressed data, it decompresses
the stream in memory and writes it to the storage device in sequential
chunks.
When the written data causes the user's allocated block usage to
cross the hard quota limit (or exceed the soft quota after the grace
period expires), the operating system's write() system call
fails. The kernel returns the standard EDQUOT (Disk
quota exceeded) error code to the unrar process.
Error Messages and Exit Codes
Upon receiving the EDQUOT signal from the operating
system, unrar cannot continue writing to disk. The
command-line utility aborts the operation and outputs an error to the
standard error (stderr) stream, typically formatted as:
Extracting filename.ext Failed
Write error: Disk quota exceeded
Cannot create filename.ext
Total errors: 1
Depending on your distribution and version of RAR/UNRAR, the message
might also state Write error: no space left on device. Once
terminated, the utility exits with a non-zero status code (typically
exit code 9 for a create error or exit code 1 for a general fatal
error), which interrupts any automated bash scripts or background tasks
relying on a successful return code (0).
The State of the Extracted Files
When unrar crashes due to a quota limit, it does not
cleanly roll back changes by default:
- Incomplete Target File: The file currently being written remains on the disk, truncated at the exact byte where the quota was hit. This file is incomplete, corrupted, and unusable.
- Previously Extracted Files: Any files from the archive that were fully decompressed before the quota was reached will remain intact in the destination directory.
- Subsequent Files: Any files queued after the failed file inside the archive will not be processed at all.
- Persistent Quota Exhaustion: Because the truncated file and previously extracted files remain on the drive, the user's quota remains at 100% capacity, blocking other programs from writing temporary data, configuration files, or logs.
How to Resolve the Error
To recover from a failed extraction caused by an exceeded disk quota:
- Identify Usage: Run
quota -sorquota -vto confirm current block limits and usage. - Remove Corrupted Data: Delete the partially
extracted file and any unwanted extracted contents using
rmto free up immediate space. - Redirect Extraction: If your quota on the target
partition cannot be increased by a system administrator, extract the
archive to a directory residing on an unconstrained mount point or
external volume using the target path argument:
unrar x archive.rar /path/to/alternative/storage/