How Unrar Handles Concatenated RAR Archives
When multiple RAR files are concatenated into a single file—such as
using binary concatenation commands like cat on Unix or
copy /b on Windows—the standard unrar utility
processes the resulting file sequentially. This article explains how the
unrar extraction engine parses archive headers, interprets
termination blocks, and handles trailing data when dealing with
concatenated independent archives and merged multi-volume sets.
Archive Block Structure and Parsing
The RAR format is structured as a continuous series of variable-length blocks. Every archive begins with a specific signature (the Marker Block), followed by an Archive Header, individual File and Service Headers interspersed with compressed data, and concludes with an End of Archive (EOA) block.
When unrar opens a file, it verifies the initial
signature and begins parsing these blocks sequentially. The parsing
engine reads each block header to determine the block type, flags, and
size, allowing it to decompress data streams or skip unneeded blocks
until it reaches the end of the structure.
Processing Concatenated Independent Archives
If two separate, complete RAR archives are concatenated together,
unrar handles the file as follows:
- Initial Extraction: The utility reads the initial marker block and parses all files contained in the first archive normally.
- Encountering the Terminator: When
unrarencounters the first archive's End of Archive block, the parser registers the logical completion of the archive. - Halting Execution: By default, standard
unrarceases extraction immediately after processing the EOA block.
Because unrar assumes the file is finished once the
first EOA block is read, the second archive appended to the file is
treated as trailing data and is completely ignored. As a result, only
the contents of the first archive are extracted, and no error is
returned unless strict integrity checks detect unexpected data appended
to the file.
Behavior with Concatenated Multi-Volume Archives
A different outcome occurs if multi-volume RAR archives (such as
.part1.rar and .part2.rar) are manually joined
via binary concatenation:
- Header Collisions: Multi-volume RAR files contain specific volume flags in their main headers and split-file indicators in their file headers. Concatenating these files into a single continuous stream places intermediate headers directly in the middle of what should be contiguous compressed data.
- Stream Corruption: Unlike some simple container formats, the compressed data in a multi-volume RAR is broken across file boundaries with metadata injected at the beginning of each new volume.
- Parser Failure: When
unrarhits an unexpected volume header or marker block mid-stream, decompression fails. The tool will typically report a checksum (CRC) mismatch, an "unexpected end of archive" error, or corrupted file alerts, preventing the successful extraction of any split files.
Signature Seeking and Trailing Data
While unrar possesses signature-scanning
capabilities—primarily used to locate the RAR marker block inside
self-extracting (SFX) executables where binary data precedes the
archive—it does not automatically re-scan for new marker blocks after
encountering an EOA block. The extraction engine is designed around the
assumption that one physical file contains one logical archive unless
explicitly informed that a file represents a multi-volume sequence via
standard volume naming conventions.