Just because internet plans are getting cheaper every day doesn't mean you should waste your bandwidth downloading the same stuff over and over. A good example is downloading development versions of Ubuntu ISO images. Ubuntu developers release daily builds, alpha, and beta ISO images every few months for testing. In the past, I used to download these images whenever they were available to test and review each edition. But not anymore! Thanks to the Zsync file transfer program, it's now possible to download only the new parts of an ISO image. This saves you a lot of time and internet bandwidth, as well as resources on the server and client sides.
What is Zsync?
Zsync is a file transfer program that is used to efficiently download and update files, particularly large files such as operating system ISO images.
It is designed to save both time and bandwidth by only downloading the parts of a file that have changed or are missing, rather than downloading the entire file again.
Zsync uses the same algorithm as Rsync, but it only downloads the new parts of a file that you already have a copy of on your computer. Rsync is mainly for synchronizing data between computers, while Zsync is for distributing data.
To put it simply, Zsync can be used to distribute a single file from a central location to thousands of downloaders.
Zsync is commonly used in the Linux community for downloading ISO images of distributions like Ubuntu. It's a handy tool for keeping large files up to date without having to download them in their entirety each time an update is available.
Zsync is completely free and open source, released under the Artistic License V2.
How Zsync Works?
Zsync works by efficiently downloading and updating files by only fetching the parts of the file that have changed or are missing, rather than downloading the entire file from scratch. Here's a more detailed explanation of how Zsync works:
- Original File: Zsync starts with an original file that you want to download or update. This original file is typically hosted on a server.
- Zsync File: Alongside the original file, a Zsync control file is provided. This file has the same name as the original file but with a "
.zsync" extension (e.g.,
originalfile.iso.zsync). The Zsync control file contains metadata and checksum information.
- Local Copy: You also have a local copy of the original file on your computer. This local copy might be an older version of the file that you want to update.
- Zsync Algorithm: Zsync uses a specialized algorithm to compare the local copy of the file with the original file. It does this by comparing checksums and metadata in the Zsync control file.
- Determining Differences: Zsync identifies the parts of the original file that are missing or have changed since your local copy was last updated. It does this without downloading the entire file.
- Partial Downloads: Zsync then downloads only the specific parts of the original file that are missing or changed. These parts are referred to as "chunks."
- Combining Chunks: Zsync combines the downloaded chunks with your local copy to create an updated version of the original file.
- Checksum Verification: Zsync uses checksums and hash functions to verify the integrity of the downloaded chunks, ensuring that they match the expected data.
- Final Updated File: Once all necessary chunks are downloaded and integrated into your local copy, you have the fully updated and correct version of the original file.
The benefits of using Zsync are listed below:
- Reduced Bandwidth Usage: You save on bandwidth because you're only downloading the portions of the file that have changed, which is much smaller than the entire file.
- Faster Downloads: Since you're downloading less data, the process is generally faster, especially when updating large files.
- Efficiency: Zsync is especially useful for downloading large files like Linux distribution ISOs or software updates, as it minimizes the time and resources required.
- Checksum Verification: Zsync uses checksums to ensure the integrity of the downloaded parts, providing a level of data integrity verification.
Zsync is available in the default repositories of most Linux distributions.
On Arch Linux and derivatives such as EndeavourOS and Manjaro Linux, you can install it using command:
$ sudo pacman -S zsync
Enable Zsync repository:
$ sudo dnf copr enable ngompa/zsync
And install it using command:
$ sudo dnf install zsync
On Debian, Ubuntu, Linux Mint:
$ sudo apt-get install zsync
$ sudo zypper install zsync
For other distributions, you can download the binary from the Zsync download page and manually compile and install it as shown below.
$ wget http://zsync.moria.org.uk/download/zsync-0.6.2.tar.bz2 $ tar xjf zsync-0.6.2.tar.bz2 $ cd zsync-0.6.2/ $ configure $ make $ sudo make install
How to Download New Parts of an ISO File using Zsync
Please be mindful that zsync is only useful if people offer zsync downloads. Currently, Debian, Ubuntu (all flavours) ISO images are available as .zsync downloads. For example, visit the following link.
As you can see in the link above, Ubuntu 23.10 daily builds are available as direct ISO and .zsync files. If you choose the .ISO version, you must download the full ISO whenever it is updated.
However, if you download the .zsync file, Zsync will download only the new changes. You do not need to download the entire ISO image every time.
A .zsync file contains a meta-data needed by zsync program. This file contains the pre-calculated checksums for the rsync algorithm; it is generated on the server, once, and is then used by any number of downloaders.
To download a .zsync file using Zsync client program, simply feed the correct zsync file URL link to Zsync program.
$ zsync <.zsync-file-URL>
$ zsync http://cdimage.ubuntu.com/ubuntu/daily-live/current/mantic-desktop-amd64.iso.zsync
If you already have the old image file in the current directory on your local system, Zsync will calculate the difference between the old and new files on the remote server and download only the new parts. You will see the calculation process as a series of dots or stars in your terminal.
Once the download is finished, you will have two files: the new file and the old file with the
If there is no copy of the file on your system, Zsync will download the entire file.
You can cancel the download process at any time by pressing CTRL-C.
Once the download is completed, Zsync will verify the checksum of the downloaded ISO file.
[...] Read mantic-desktop-amd64.iso.part. Target 45.7% complete. downloading from http://cdimage.ubuntu.com/ubuntu/daily-live/current/mantic-desktop-amd64.iso: #########----------- 45.7% 4.1 kBps ##############------ 72.2% 15.7 kBps TA #################### 100.0% 2656.4 kBps DONE verifying download...checksum matches OK used 2366558208 local, fetched 2807430188
Zsync is a must-have tool for those who test Ubuntu development ISOs.
Imagine if you used the direct .ISO file or torrent, you would lose around 5 GB of bandwidth whenever you downloaded a new image.
Instead of downloading entire images (alpha, beta, and daily builds), Zsync downloads only the new parts of the ISO file if you already have a copy of an older version on your system.
If you are using Zsync to download an Ubuntu ISO and facing issues where it only creates .part files and the checksum doesn't match the original file, there could be several reasons for this problem. Here are some possible explanations and suggestions to resolve the issue:
1. Incomplete Download:
The most common reason for this issue is an interrupted or incomplete download. Zsync downloads the file in parts and then combines them to create the final ISO. If the download process is interrupted, it may leave behind .part files. Make sure you have a stable internet connection and sufficient disk space to complete the download.
Delete the incomplete files and try downloading the ISO again using Zsync.
2. Corrupted Original File:
If the original Ubuntu ISO file you are trying to download is corrupted or incomplete, Zsync won't be able to create a valid ISO file.
Verify that the original Ubuntu ISO file you are trying to download is not corrupted. You can do this by checking its checksum on the official Ubuntu website.
3. Incorrect Zsync Command:
Ensure that you are using the correct Zsync command with the correct parameters. The syntax for using Zsync to download an ISO file should be something like:
Replace "xx.x" with the version of Ubuntu you want to download.
Double-check your Zsync command to ensure it is accurate.
4. Firewall or Network Issues:
Sometimes, firewall settings or network issues can interfere with the download process, causing incomplete downloads or checksum mismatches.
Make sure your firewall is not blocking the Zsync download, and try downloading from a different network if possible.
5. Zsync Version:
Ensure that you are using a compatible version of Zsync for the Ubuntu ISO you are trying to download. Using an outdated or incompatible version of Zsync can lead to issues.
Update Zsync to the latest version if necessary.
6. Disk Space:
Verify that you have enough free disk space to store the downloaded ISO file. Zsync may not be able to complete the download if your disk is full.
Clear some space on your disk or download the ISO to a location with sufficient free space.
7. Server Issues:
It's possible that the server hosting the Ubuntu ISO file is experiencing issues or high traffic, which can affect the download process.
Try downloading the ISO file at a different time when server traffic is lower.
By addressing these potential issues, you should be able to resolve the problem you are facing when using Zsync to download an Ubuntu ISO. If the issue persists, consider using a different method or downloading the ISO from a different mirror or source.
Frequently Asked Questions
A: Zsync is a file transfer utility that allows you to efficiently download and update files by downloading only the parts of a file that have changed or are missing. It is particularly useful for large files like operating system ISO images.
A: Zsync works by comparing your local copy of a file with the original file hosted on a server. It uses a control file (.zsync) alongside the original file to determine the differences. It then downloads and integrates only the specific parts of the file that have changed or are missing, minimizing both time and bandwidth usage.
A: Zsync can be used for any type of file, but it is most commonly used for large files that are regularly updated, such as Linux distribution ISO images, software updates, and other downloadable packages.
A: The main benefits of using Zsync include reduced bandwidth usage, faster downloads, efficiency in updating large files, and data integrity verification through checksums.
A: Zsync is available for Unix-like operating systems, including Linux and macOS. It may not be available for Windows out of the box, but there are third-party tools and ports that can be used to run Zsync on Windows.
In conclusion, Zsync is a valuable tool for optimizing file downloads and updates, particularly when dealing with large files like operating system ISO images and software packages.
By efficiently downloading only the changed or missing parts of a file, Zsync minimizes bandwidth usage and speeds up the process. Its checksum verification ensures data integrity, adding an extra layer of reliability to the downloaded content.
If you are looking to save time and bandwidth during file transfers, Zsync is recommended!