Commands.page Logo

How to Make Aria2 Continue When Mirrors Fail on Ubuntu

This article explains how to configure the aria2 download utility on Ubuntu to ensure downloads persist even when specific mirror servers become unavailable. It identifies the essential command-line option required for resilience and demonstrates how to use multiple sources effectively to maintain download speed and reliability without manual intervention.

The primary option that allows aria2 to continue downloading even if some mirrors fail is --continue, often shortened to -c. While aria2 is designed to handle multiple connections automatically, using this flag ensures that partially downloaded data is not discarded if a connection drops or a specific mirror stops responding. When combined with multiple URIs, this option provides a robust solution for completing large files over unstable networks.

To utilize this feature, you must provide more than one URL for the same file. Aria2 treats these additional URLs as mirrors. If one mirror fails during the transfer, aria2 attempts to retrieve the missing pieces from the remaining active servers. The --continue option ensures that if the download process itself is interrupted, you can resume exactly where it left off without restarting from zero.

Here is the basic command structure for Ubuntu users:

aria2c -c -x 16 -s 16 http://mirror1.com/file.zip http://mirror2.com/file.zip

In this example, -x 16 sets the maximum number of connections per server, and -s 16 splits the file into 16 pieces. The -c flag activates the continue function. If mirror1.com fails, aria2 will seamlessly switch to mirror2.com to fetch the remaining data, ensuring the download completes successfully.