Can Unrar Extract Actively Appended Archives?

Attempting to extract a RAR archive while another program is actively writing or appending data to it generally results in errors rather than a successful extraction. Because of how the RAR format structures compressed data, along with operating system file-locking mechanisms and built-in integrity checks, unrar expects an archive to remain static during read operations. While certain command-line flags allow partial extraction of finished segments within an incomplete file, extracting a dynamically growing archive is unreliable and prone to failure.

RAR File Architecture and Header Constraints

RAR files are organized into structured blocks consisting of archive headers, file headers, compressed data streams, and service blocks. Many RAR archives—especially modern RAR5 archives—rely on specific metadata blocks or end-of-archive markers to validate the structure.

When another process is actively appending to a RAR file, the internal offsets and block sizes are continuously shifting or missing. If unrar parses the file while new bytes are being appended, it will typically encounter an "Unexpected end of archive" error as soon as it attempts to read past the current write point or when it fails to find the expected trailing metadata.

Data Integrity and Checksum Failures

Every file packed inside a RAR archive includes a checksum (CRC32 for RAR4 or BLAKE2sp for RAR5) to verify data integrity upon decompression.

If unrar attempts to decompress a file entry that has only been partially written to disk:

  • The decompressor reaches an unexpected end-of-file (EOF) within the compressed stream.
  • The calculated checksum of the decompressed data will not match the checksum stored in the file header.
  • By default, unrar aborts the operation and deletes the incomplete, corrupted extracted file.

Operating System File Locking

The underlying operating system plays a significant role in whether unrar can even open the file:

  • Windows: Programs writing to files typically open them with exclusive write access or restricted sharing flags. If the writing process does not explicitly grant read-sharing permissions (FILE_SHARE_READ), unrar cannot open the file and will immediately fail with a sharing violation or access denied error.
  • Linux and macOS: Unix-like systems use advisory locking by default. While this allows unrar to open and read a file that another process is writing to, it does not prevent data races. The read pointer will quickly overtake the write pointer, triggering read errors.

Partial Recovery Using the -kb Flag

If an archive is being appended sequentially and you must extract files that have already been completely written, you can run unrar with the -kb (Keep Broken) switch:

unrar x -kb archive.rar

The -kb parameter instructs unrar not to delete extracted files when a CRC error or unexpected EOF occurs. Any files stored completely in the archive prior to the current write offset may extract successfully, but the overall extraction process will still terminate with an error code once it reaches the incomplete portion of the archive. This method will not work if the archive is created as a "solid" archive, because solid archives compress multiple files into a single, continuous data stream that requires sequential, error-free reading from start to finish.

Instead of attempting concurrent extraction, implement one of the following workflows:

  1. Wait for Process Completion: Monitor the writing process by tracking its process ID (PID) or monitoring file handle release using tools like lsof or fuser on Linux, or Handle on Windows.
  2. Atomic Renaming: Have the writing program write to a temporary file extension (e.g., archive.rar.part or archive.rar.tmp) and rename the file to .rar only after the write operation has closed cleanly.
  3. Multi-Volume Archives: If the data must be processed in chunks while being generated, configure the archiving tool to create a multi-volume archive (.part1.rar, .part2.rar). You can extract finished volumes once their subsequent volume has begun writing, provided the archive is non-solid.