What Happens When unrar Runs Out of Inodes?
Extracting an archive with unrar on a filesystem that
has run out of inodes causes the extraction process to fail immediately
when attempting to write new files or directories. Even if the disk has
gigabytes of unallocated storage space remaining, the operating system
cannot allocate metadata for new entries. Consequently,
unrar throws file creation errors, halts or skips files,
and leaves behind an incomplete extraction with non-zero exit status
codes.
The Underlying System Error
In Unix-like filesystems (such as ext4, XFS, and UFS), an inode stores metadata about a file or directory, including permissions, ownership, and data block locations. Every file and folder consumes exactly one inode. When the filesystem reaches zero free inodes, the kernel cannot register new files.
When unrar attempts to unpack an entry, it issues system
calls such as open() (with the O_CREAT flag)
or mkdir(). Because no inodes are available, the kernel
rejects these calls and returns the ENOSPC error code.
Counterintuitively, the operating system translates ENOSPC
as "No space left on device," which often misleads users into thinking
they have exhausted raw disk storage capacity rather than inode
entries.
How unrar Reacts
During execution, unrar encounters the kernel rejection
and exhibits specific behaviors:
- Error Messages: For every file it tries to unpack
after inodes are exhausted,
unrarprints an error directly to standard error or standard output:Cannot create <filename> No space left on device - Process Interruption: Depending on the exact flags
used,
unrarwill either prompt the user for an action, skip the failing files, or terminate immediately. - Exit Codes: The utility terminates with a non-zero exit code (typically exit code 1 or 9 depending on the build and specific failure mode), indicating a fatal write failure to any calling scripts or processes.
State of the Filesystem After Failure
Running out of inodes during extraction leaves the filesystem in a messy, partial state:
- Incomplete Extraction: Any files processed before the inode exhaustion will remain intact on the filesystem. Any files queued after the limit was reached will be missing.
- Zero-Byte Files: In some edge cases, an inode might be allocated right as the limit is hit, but subsequent metadata or directory links cannot be established, leaving empty or truncated files.
- No Automatic Rollback: Standard
unrarimplementations do not provide transactional rollbacks. It will not clean up the files it successfully unpacked prior to the failure, requiring manual intervention to remove the partial data.
Identifying and Resolving the Issue
If an extraction fails with disk space errors when storage appears available, check inode consumption with the following command:
df -iLook at the IUse% column for the target partition. If it
shows 100%, the filesystem has no remaining inodes.
To resolve the issue and allow unrar to complete:
- Delete large numbers of small, unused files, such as stale cache directories, old session files, or massive temporary log files.
- Move the archive to another filesystem or a dynamic-inode filesystem (such as Btrfs or ZFS) that does not impose fixed inode limits.
- Re-run the
unrarcommand once free inodes appear in thedf -ioutput.