Technology has sure been progressing at a faster pace, and the internet is cheaper than ever. However, there is no fun in wasting the bandwidth and your valuable time on downloading the same file over and over again. Unfortunately, the updated versions of a file with minor changes still force us to do exactly that.
Zsync File Transfer Utility
To get over this situation, we recommend Zsync. It is a file transfer utility that allows you to download only new parts of a file, given that the file provider has a .zsync file on the server. Thankfully, several distribution maintainers are starting to use this format, making it a much easier way to keep your ISO images to the latest version without downloading them every time they have been updated with minor updates.
How it works
Zsync works on a simple CLI command, and what it basically does is compare the file that you maintain, to the URL that you provided. If there are any additional parts of the file, Zsync will download those parts for you. If not, it will download the whole file.
It uses the URL as a central server to which the computers of the downloaders are compared. Any difference will be updated. It works like a massive network of shared directories.
Zsync installation on Ubuntu, Linux Mint, Arch Linux, Fedora
Zsync is available in most distributions’ official repositories, so you can just install Zsync from the command line.
For Ubuntu/Linux Mint (or any derivatives):
sudo apt-get install zsync
For Arch and derivatives:
sudo pacman -S zsync
For Fedora, you have to enable the repository first:
sudo dnf copr enable ngompa/zsync
sudo dnf install zsync
If none of these work, you can download and install the source code. For that, enter these sequence of commands. You can obtain the latest download link from the Zync website.
tar xjf zsync*
sudo make install
And that’s all you need to do for the installation.
Sample output on Linux Mint
New parts of an existing file
The usage is fairly simple. The things that you need are :
- The URL of the zsync file to be downloaded.
- An older version of the same file (if you have it).
In this example, I will be downloading Ubuntu. I already have the ISO file of Ubuntu 18.04-2, and I will update it with the daily build. This is the URL to find Ubuntu’s daily builds.
The filename of the already existing file has to be added with the -i attribute. So the syntax for that is:
zsync -i ubuntu-18.04.2-desktop-amd64.iso http://cdimage.ubuntu.com/ubuntu/daily-live/20190222/disco-desktop-amd64.iso.zsync
Here, it’s visible that after comparing the files, it is downloading the rest of the file from the given URL!
If the file doesn’t exist…
If the older version is not present, and you only put in the URL of the .zsync file, it will additionally download the whole original file. So in this case, it will download the original ISO file of Ubuntu too.
Zsync is an excellent file transfer utility that can save a lot of your time and bandwidth. Even though not supported by a lot of distributions, it’s still spreading quite fast. So next time before downloading a distribution’s new version, make sure to check if it has a .zsync download.
That’s all for today. Cheers!