How to use jigdo-lite

jigdo is a method of downloading CD and DVD images over the Internet (and other large files) and is used by Debian and Ubuntu when new releases are created. jigdo files contain a list of the files that need to be included in the new CD or DVD ISO image and you can get the files from local sources and over the Internet. This means when you want to create ISO images for updated versions of Debian, you only need to download the changed files. This saves both bandwidth and and time. This post looks at how to use the jigdo-lite command line tool to create a new DVD ISO image for the most recent Debian 4.0r3 release.

Mount the original DVD

First of all you need to mount the original DVD, either the physical media itself or an ISO image. If you are using the physical media then all you should need to do is put the DVD into your DVD drive and with most Linux distributions it will mount automatically at some mount point at either /media or /mnt . If it doesn’t mount automatically then you’ll need to do it yourself. For example:

mount /dev/cdrom /mnt/cdrom

If you want to mount an ISO image instead, at eg /mnt/cdrom, then you would do this:

mount -o loop debian-40r2-i386-DVD-2.iso /mnt/cdrom

Using iigdo-lite

Now that we have access to the files from the previous release mounted at eg /mnt/cdrom we can run the jigdo-lite command and create a new ISO image for the latest release, using a) files from the old release and b) updated files from a remote FTP or HTTP server. From the command line, run:

jigdo-lite

This will display something along these lines:

Jigsaw Download "lite"
Copyright (C) 2001-2005  |  jigdo@
Richard Atterer          |  atterer.net
Loading settings from `/home/chris/.jigdo-lite'
-----------------------------------------------------------------
To resume a half-finished download, enter name of .jigdo file.
To start a new download, enter URL of .jigdo file.
You can also enter several URLs/filenames, separated with spaces,
or enumerate in {}, e.g. `http://server/cd-{1_NONUS,2,3}.jigdo'
jigdo []: 

You now tell jigdo-lite the location of the jigdo file for the ISO image you want to create. The example I am using is to create a new image for Debian 4.0r3 i386 DVD 2. The jigdo files for this release can be found at http://cdimage.debian.org/debian-cd/current/i386/jigdo-dvd/

For my example, we would enter “http://cdimage.debian.org/debian-cd/current/i386/jigdo-dvd/debian-40r3-i386-DVD-2.jigdo” as the jigdo file and then hit <enter>, and you’ll see something like this:

Downloading .jigdo file
--21:44:05--  http://cdimage.debian.org/debian-cd/4.0_r3/i386/jigdo-dvd/debian-40r3-i386-DVD-2.jigdo
           => `debian-40r3-i386-DVD-2.jigdo'
Resolving cdimage.debian.org... 130.239.18.137, 2001:6b0:e:2018::137
Connecting to cdimage.debian.org|130.239.18.137|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 103,090 (101K) 

100%[========================================================>] 103,090       69.70K/s

21:44:07 (69.57 KB/s) - `debian-40r3-i386-DVD-2.jigdo' saved [103090/103090]

-----------------------------------------------------------------
Images offered by `http://cdimage.debian.org/debian-cd/4.0_r3/i386/jigdo-dvd/debian-40r3-i386-DVD-2.jigdo':
  1: 'Debian GNU/Linux 4.0 r3 "Etch" - Official i386 DVD Binary-2 20080217-11:31 (20080217)' (debian-40r3-i386-DVD-2.iso)

Further information about `debian-40r3-i386-DVD-2.iso':
Generated on Sun, 17 Feb 2008 12:45:35 +0100

-----------------------------------------------------------------
If you already have a previous version of the CD you are downloading, jigdo can 
re-use files on the old CD that are also present in the new image, and you do not 
need to download them again. Mount the old CD ROM and enter the path it is mounted 
under (e.g. `/mnt/cdrom'). Alternatively, just press enter if you want to start 
downloading the remaining files.

You can also enter a single digit from the list below to
select the respective entry for scanning:
  1: /mnt/cdrom
Files to scan: 

If you have used iigdo-lite before then it remembers the previous locations you scanned for files and presents them as numberer options (eg where it says 1: /mnt/cdrom above). You can either type in this number and press <enter> or type in the mount point and press enter. We mounted the previous DVD at /mnt/cdrom at the start of this post, so we would enter /mnt/cdrom and press enter.

jigdo-lite will then download the .template file and start scanning the mount point for files that it can use. It then creates a temporary image of the DVD or CD and writes the files it has found and can use into the image at the appropriate location. The output from this looks like this:

Found 3338 of the 3383 files required by the template
Copied input files to temporary file `debian-40r3-i386-DVD-2.iso.tmp' - 
repeat command and supply more files to continue

This tells us that 3338 of the files required for the new release are available on the old release’s DVD, and that it’s only going to need to download a further 45 files to finish the image off. This shows the bandwidth saving that using jigdo offers – instead of having to download a full 4GB DVD ISO image we’re only having to download a very few files if not much has changed between releases.

At this stage you are able to enter another mount point containing files, but just press <enter> again and then it will prompt you for an FTP or HTTP location like so:

The jigdo file refers to files stored on Debian mirrors. Please
choose a Debian mirror as follows: Either enter a complete URL
pointing to a mirror (in the form
`ftp://ftp.debian.org/debian/'), or enter any regular expression
for searching through the list of mirrors: Try a two-letter
country code such as `de', or a country name like `United
States', or a server name like `sunsite'.
Debian mirror []: 

You then enter the location of a Debian mirror (eg ftp://mirror.pacific.net.au/debian/) and it begins to download the files required. They are stored in a temporary directory and after every 10 files are downloaded they are added into the temporary image.

Once it has finished creating the image, you’ll see something like this:

Finished!
The fact that you got this far is a strong indication that `debian-40r3-i386-DVD-2.iso'
was generated correctly. I will perform an additional, final check,
which you can interrupt safely with Ctrl-C if you do not want to wait.

25% 1167123k/4585282k writing image

OK: Checksums match, image is good!

This indicates the image has been created and is good to go. You can now safely burn it to DVD.

Summary

In summary, jigdo and the command line tool jigdo-lite allow you to create new CD and DVD ISO images from CDs or DVDs from previous releases of Debian and Ubuntu. It searches the old release for files that are the same as the current release, and then downloads anything it couldn’t find from an FTP or HTTP mirror. This saves massive amounts of bandwidth and time. In the example used on this page, creating DVD 2 from the Debian 4.0r3 i386 release, and using files from the 4.0r2 release, we only needed to download 45 additional files. Compare that with over 4GB for a full DVD image and you can see the bandwidth savings.