Scenario
When users have problems running Ubuntu or an Ubuntu flavour live or installing it, we often ask them to check with sha256sum that the download was successful. But there can be problems also in the next step, which can be cloning or extracting from the ISO file to a USB drive.
My experience is that cloning is a very reliable method to make a USB boot drive to run Ubuntu live or install Ubuntu into a computer. However, sometimes it fails (caused by various problems, which will not be discussed here).
Method to check that cloning was successful
When booting into a USB drive with Ubuntu Desktop or an Ubuntu flavour (Kubuntu, Lubuntu … Xubuntu), a writable partition is created, if there is some free drive space ‘behind’ the image of the ISO file. This makes straightforward checking of the cloning process fail, unless you remember to check before booting into it.
The tool diff-image-drive is a bash shellscript that can help you solve this problem (both with and without a writable partition). It can check the content of the image (of the ISO file) in the USB drive except where the partition table and writable partition and backup partition table are located.
$ diff-image-drive
usage: sudo diff-image-drive <image-file> <device>
examples: sudo diff-image-drive ubuntu.iso /dev/sdc
sudo diff-image-drive myfile.img /dev/sdc
version: 1.3
The usage of diff-image-drive is illustrated below,
You can download the diff-image-drive file at GitHub - sudodus/files at master · GitHub
