How Torrent Clients Resume Interrupted Downloads

When a BitTorrent download is paused, canceled, or abruptly interrupted by a system crash or loss of connection, the torrent client does not need to start over from scratch. Instead, it relies on cryptographic hash checks, piece-based file segmentation, and local resume logs to quickly identify which portions of the file are already saved correctly on your storage drive and only request the missing pieces from the peer network.

The Piece Architecture and Metadata

BitTorrent does not treat files as single, continuous streams. Instead, the torrent creator splits the target file (or collection of files) into thousands of small, fixed-size chunks known as “pieces,” typically ranging from 256 KB to 16 MB each.

When a torrent is created, a cryptographic hash (historically SHA-1, or SHA-256 in BitTorrent v2) is calculated for every individual piece. This complete list of hashes is stored directly inside the .torrent metadata file or downloaded via a magnet link.

The Bitfield and Fast Resume State

During active downloads, the torrent client tracks progress using a simple data structure called a bitfield—a compact binary map where each bit represents a piece of the file (1 for complete and verified, 0 for missing).

Under normal operation, when you pause a torrent or shut down the application, the client writes a “fast resume” file to your disk. This file saves the current bitfield, the locations of incomplete chunks, and file modification timestamps. When reopened, the client simply reads this local state file and instantly resumes downloading the missing bits without re-reading the actual files on your drive.

The Hash Checking Process

If a download is interrupted abruptly (such as during a power outage or application crash), the fast resume state might become missing or invalid. In this scenario, the client initiates a hash check (often displayed as “Checking…”):

  1. Reading Local Files: The client reads the existing data already written to your hard drive, chunk by chunk, matching the piece size defined in the torrent metadata.
  2. Generating Hashes: It runs the cryptographic hash algorithm across each local piece.
  3. Comparing Hashes: It compares the calculated hash against the master hash list from the torrent metadata.
  4. Validation:
    • If the hashes match, the client marks that piece as verified (sets the bit to 1).
    • If the hashes do not match (indicating corruption or partial data), the piece is discarded and marked as missing (sets the bit to 0).

Requesting Only Missing Data

Once the hash check or fast-resume validation is complete, the torrent client sends its updated bitfield to connected peers and requests only the specific pieces marked as missing. Because completed pieces are independently validated and permanently written to disk, the client never has to re-download valid data.