Unrar File Permissions in Multi-Volume Archives
Multi-volume RAR archives split large data sets or individual large
files across several sequential files, raising questions about how file
metadata is preserved. This article explains how the unrar
utility processes, tracks, and applies file permissions when extracting
archives spanning multiple volumes, particularly when dealing with split
files, header data, and varying host file systems.
Metadata Storage Across Volumes
In the RAR archive format, file metadata—including standard POSIX file permissions (owner, group, and mode bits) or Windows file attributes—is written into file headers. When a single large file spans multiple volumes, the primary metadata record is written into the file header of the volume where the file begins. Subsequent volumes containing continuation segments include continuation flags to signal that the data stream is part of an ongoing file rather than a new entry.
Because the definitive permissions are stored at the start of the split file entry, differing permissions cannot legitimately exist for the same individual file across different volume segments under normal conditions.
How Unrar Processes Split Files
When unrar extracts a file that spans multiple volumes,
it executes the following sequence:
- Header Parsing:
unrarreads the initial volume and stores the file's defined permissions, timestamps, and attributes in temporary memory. - Sequential Assembly: The utility extracts and
appends subsequent data blocks from consecutive volumes
(
.part1.rar,.part2.rar, etc.). Any continuation headers encountered in later volumes do not overwrite the primary permission metadata read from the starting volume. - Delayed Application: Operating systems lock or
alter file attributes if permissions are applied before writing is
finished. Consequently,
unrarwrites the entire payload across all volumes before applying the final permissions. Once the final volume's stream is validated (typically via CRC32 or BLAKE2 checksums) and the file descriptor is closed,unrarissues a system call (such aschmodorchownon POSIX systems) using the metadata retrieved from the first volume.
Discrepancies Across Distinct Files in the Set
If a multi-volume archive contains thousands of smaller, non-split files distributed across different volumes, each file maintains its own discrete file header within the volume where it resides. In this scenario:
- Independent Evaluation:
unrartreats each file independently. The permissions of a file stored in the first volume have no influence over the permissions of a distinct file stored in the second or third volume. - Archive-Level Defaults: If specific attributes are
omitted from an entry's header,
unrarfalls back to the system's default environment mask (umaskon Unix/Linux) rather than inheriting attributes from preceding files in the archive sequence.
Impact of User Privileges and Command Flags
The extraction environment dictates whether stored permissions can be applied faithfully regardless of volume structure:
- POSIX Permissions: By default, standard execution
without elevated privileges limits
unrarto setting permissions permitted by the current user's shellumask. Ownership (UID and GID) cannot be assigned to another user unlessunraris run asrootor with appropriate administrative capabilities. - Specific Flags: Switches such as
-ow(save/restore file owner and group) and-op(restore file permissions) explicitly commandunrarto enforce the permissions stored across the archive headers. If permissions cannot be set due to permission denials or non-compatible target file systems (such as writing to a FAT32 drive),unraroutputs a warning and allows the underlying operating system to assign default access rights.