Home page of this blog

Sunday, October 18, 2009

Downloading Ubuntu daily build livecd using zsync

zsync is a program with artistic license v2

zsync can be used to just download only the diff/partial/delta of a big file from a server instead of downloading the entire big file again. For this to work, server should provide a .zsync file which is also called control file (actually a diff file)

The real advantage of zsync is we don't need to download the entire blocks (chunks or bits) we already have in local,  again from server. This saves bandwidth as the difference (between the local file which is old and new file in server) which we download will be very small compared to a big download. Actually in the following example, I downloaded only around 100 MB instead of downloading 700 MB

In this example I will explain how I downloaded daily build of Ubuntu livecd using zsync. (from http://cdimage.ubuntu.com/daily-live/current/)

I already have a  64 bit ubuntu karmic live cd downloaded on 17/Oct/2009. Now I can download the daily build 18/Oct/2009 ubuntu karmic live cd again or just download the delta and rebuild the 18/Oct/2009 using zsync

The first thing I did was installed zsync

sudo apt-get install zsync

Then I went to http://cdimage.ubuntu.com/daily-live/current/ and located the .zsync file. The .zsync file is also called the control file and it should be present on the server (The server should support .zsync for this to work)

I created a new directory called Oct18 and saved the new sha256sums for the 18/Oct build  inside it (http://cdimage.ubuntu.com/daily-live/current/SHA256SUMS)

Then, I copied the 17/Oct/2009 daily build karmic-desktop-amd64.iso to this new directory named Oct18

In command line (gnome-terminal) I went to the Oct18 directory gave

zsync http://cdimage.ubuntu.com/daily-live/current/karmic-desktop-amd64.iso.zsync

The above command took care of calculating what missing portion of the iso it needed to download and started downloading the difference. zsync takes care not to overwrite the original file until it completely downloads all the missing portion and rebuilds the new file. It puts all the missing blocks inside a .part file and is quite powerful that it will continue from the last time where it left, if closed in the middle. Here is a screenshot of zsync in action




After downloading, I checked if zsync successfully downloaded 18/Oct livecd, using sha256sum command and SHA256SUMS (http://cdimage.ubuntu.com/daily-live/current/SHA256SUMS) for 18/Oct livecd   (Ubuntu started providing sha256sums along with md5sums for ubuntu iso's and is considered the best hashing which can't be mimicked)

sha256sum karmic-desktop-amd64.iso | grep 36b3674b3542f03691365a27b6e6f98406c0f0842c047dacc2c5dca392355740

The  following screenshot shows that it was a success!!


6 comments:

  1. Also if you are interested of keeping updated the daily alternate image another valid method is to use jigdo package.

    There is no jigdo file to be used with the daily live images.

    The best is to made a local cache of dl packages with the apt-cacher-ng package forcing jigdo and local and lan pc to use the apt-cacher-ng deb proxy.

    Hope this helps

    ReplyDelete
  2. I don't know about jigdo much. I will try to explore jigdo and apt cacher ng.

    ReplyDelete
  3. And thanks for that info about jigdo, it certainly helps

    ReplyDelete
  4. Do you know how much time between releases at cdimage.ubuntu.com?. The last is 28th october (not daily build at all ;).
    Thanks.

    ReplyDelete
  5. No I don't know. But you know what. I had the oct 28th build and checked its SHA256SUM and found it is the same as the final release!!!

    ReplyDelete
  6. Thank you so much Sankaran because the quick response. And I'm sorry the big delay.
    Byez.

    ReplyDelete