What Happens When Unrar Hits a Filesystem Quota?
When extracting an archive using unrar on a system with
storage limits, encountering a filesystem quota warning leads to
distinct behaviors depending on whether a soft or hard limit is
breached. A soft quota warning allows extraction to proceed normally
while the operating system alerts the user and starts a grace period
timer. However, if the extraction pushes usage past the hard quota or if
the grace period has expired, the operating system denies further disk
writes, causing unrar to fail with a write error and abort
the operation.
Soft Quota Warning vs. Hard Quota Limit
Filesystems using quota management (such as ext4, XFS, or ZFS) typically enforce two thresholds:
- Soft Limit (Warning Trigger): When
unrarextracts data that pushes storage usage above the soft limit, a quota warning is triggered. The kernel logs a notification to the system log (such asdmesgor syslog) and may display a warning message in the user's terminal session. Because a grace period immediately begins, the kernel does not block the underlyingwrite()system calls. As long as the archive contents do not exceed the hard limit before extraction finishes,unrarcompletes successfully without interruption. - Hard Limit (Absolute Ceiling): If the extracted files push disk usage to the hard limit, or if the soft quota grace period has already lapsed, the kernel immediately stops allocating new disk blocks.
How unrar
Responds to Write Failures
When the hard limit is reached, any subsequent write()
call made by unrar fails with an EDQUOT (Disk
quota exceeded) or ENOSPC (No space left on device) system
error.
Upon receiving this error from the operating system,
unrar responds in the following manner:
- Halts the Process: The utility immediately interrupts the extraction process because it cannot append additional bytes to the destination file.
- Displays Error Messages:
unrarprints a standard write failure message to standard error (stderr), typically outputting messages such as:Write error: only 0 of 512 bytes written Cannot create file_name Disk full? - Deletes the Truncated File (Default Behavior): By
default,
unrarremoves the partially extracted file that caused the failure to prevent leaving corrupted or incomplete files on the filesystem. However, if the user explicitly supplied the-kb(Keep broken extracted files) switch, the truncated file remains on disk, occupying whatever space was allocated prior to reaching the quota. - Returns a Non-Zero Exit Code: The program terminates with a fatal error exit code (typically exit code 9 for write/create errors or exit code 1 for warnings), allowing automated scripts to detect that the operation failed.
Any files that were fully extracted prior to triggering the hard quota limit remain intact on the filesystem. To resolve the issue, storage space must be freed or user quotas must be increased before re-running the extraction.