How to Extract Corrupt RAR Files Using Unrar

Extracting files from a corrupt RAR archive is possible using the command-line utility unrar, provided you instruct the tool to retain damaged data instead of deleting it. By default, unrar deletes any file that fails a Cyclic Redundancy Check (CRC). However, by utilizing the "keep broken files" switch (-kb), you can force unrar to save partially recovered or corrupted files while extracting completely intact files alongside them. This guide explains how this mechanism works, the exact commands to use, and the technical limitations you may encounter.

The Default Behavior vs. The -kb Flag

When unrar encounters corrupted bytes during extraction, it reports a CRC or checksum error and immediately deletes the affected file from your disk to prevent corrupted data from being used.

To override this behavior and keep the valid portions of a file up to the point of corruption, use the -kb (Keep Broken) switch:

unrar x -kb archive.rar
  • x: Extracts files with their full directory path.
  • -kb: Prevents unrar from deleting files that produce CRC errors.

When running this command, unrar will fully extract any undamaged files within the archive. For damaged files, it will extract as much data as it can read and leave the partial file on your drive rather than discarding it.

Solid vs. Non-Solid Archives

The success of extracting data from a corrupt archive largely depends on whether the archive was compressed as "solid" or "non-solid":

  • Non-Solid Archives: Each file is compressed independently. If file A is corrupt, unrar can skip or partially extract file A, and file B will remain completely unaffected and fully recoverable.
  • Solid Archives: Multiple files are treated as a single continuous data stream to achieve higher compression ratios. If corruption occurs early in a solid archive, unrar cannot decode the stream past the corrupted sector, which often prevents the extraction of any subsequent files in the archive.

Using Built-In Recovery Records

If the archive was created with a recovery record (RR), you should attempt to repair the archive before extracting broken files. The repair process uses Reed-Solomon error correction to reconstruct missing or altered bytes.

Run the repair command:

unrar r archive.rar

This creates a new file named fixed.archive.rar. If the damage falls within the threshold of the recovery record, the archive will be restored to an error-free state, allowing you to extract all files without needing the -kb switch.

What to Expect from Extracted Corrupt Files

Files extracted with the -kb switch will contain missing or zeroed-out blocks:

  • Media Files (Video and Audio): Formats like MP4, MKV, or MP3 often play successfully up to the corrupted section, or may skip the damaged frames entirely.
  • Text and Raw Data: Plain text, logs, and uncompressed data will generally be readable up to the point of corruption.
  • Executables and Compressed Formats: Software installers, databases, and sub-archives (such as ZIP or nested RAR files) will usually fail to open or execute, as even a single corrupted byte breaks structural validation.