Mkusb-nox for repeated iso-testing

Introduction

It is a lot of work and also some risk, when we create boot drives from the daily iso files. I upgraded the old mkusb-nox (text mode shellscript) in order to make it efficient not only with USB pendrives and memory cards, but also SSDs connected via adapters (they may appear as internal drives and are protected by default).

mkusb-nox comes with the mkusb program package, the updated version via ppa:mkusb/unstable and after a couple of weeks of testing it will replace the old version in the stable ppa:mkusb/ppa.

The following paragraphs shows the background and how it can work and there are a few links at the end of this post.

Fast and reliable with an SSD instead of a pendrive

The SSD is seen as a SATA drive


$ ls -l /dev/disk/by-id|grep sdc
lrwxrwxrwx 1 root root  9 sep  3 08:11 ata-OCZ-AGILITY3_OCZ-LG1P09233GJ67M09 -> ../../sdc
lrwxrwxrwx 1 root root 10 sep  3 08:11 ata-OCZ-AGILITY3_OCZ-LG1P09233GJ67M09-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 sep  3 08:11 ata-OCZ-AGILITY3_OCZ-LG1P09233GJ67M09-part2 -> ../../sdc2
lrwxrwxrwx 1 root root 10 sep  3 08:11 ata-OCZ-AGILITY3_OCZ-LG1P09233GJ67M09-part3 -> ../../sdc3
lrwxrwxrwx 1 root root  9 sep  3 08:11 wwn-0x5e83a9771439682e -> ../../sdc
lrwxrwxrwx 1 root root 10 sep  3 08:11 wwn-0x5e83a9771439682e-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 sep  3 08:11 wwn-0x5e83a9771439682e-part2 -> ../../sdc2
lrwxrwxrwx 1 root root 10 sep  3 08:11 wwn-0x5e83a9771439682e-part3 -> ../../sdc3

But it is a hot-plugged drive


$ lsblk -o name,size,fstype,label,hotplug,model /dev/sdc
NAME    SIZE FSTYPE  LABEL                      HOTPLUG MODEL
sdc    55,9G iso9660 Xubuntu Core 20.04 - amd64       1 ITY3            
├─sdc1  818M iso9660 Xubuntu Core 20.04 - amd64       1 
├─sdc2  3,9M vfat    Xubuntu Core 20.04 - amd64       1 
└─sdc3 55,1G ext4    writable                         1 

lshw shows that is is connected via USB


$ sudo lshw  # plus mark,copy,paste:
 *-usb
      description: Mass storage device
      product: 1153-3G Ext. HDD
      vendor: Asmedia Technology Inc.
      physical id: 3
      bus info: usb@4:1.1.3
      logical name: scsi9
      version: 1.00
      serial: 00000000015AD
      capabilities: usb-3.00 scsi
      configuration: driver=uas speed=5000Mbit/s
    *-disk
         description: SCSI Disk
         product: ITY3
         vendor: OCZ-AGIL
         physical id: 0.0.0
         bus info: scsi@9:0.0.0
         logical name: /dev/sdc
         version: 0
         serial: DA51000000000
         size: 55GiB (60GB)
         capabilities: partitioned partitioned:dos
         configuration: ansiversion=6 logicalsectorsize=512 sectorsize=512 signature=18c263b4

Testing

My directory with zsynced iso files for iso-testing


$ pwd
/media/multimed-2/test/lubuntu

$ ls -trl focal* jammy* kinetic*
-rw------- 1 nio nio 2688100352 aug  9 12:03 jammy-desktop-amd64.iso.zs-old
-rw------- 1 nio nio 2694133760 aug 12 17:17 jammy-desktop-amd64.iso
-rw------- 1 nio nio 2792142848 aug 26 16:55 kinetic-desktop-amd64.iso.zs-old
-rw------- 1 nio nio 1996488704 aug 29 16:21 focal-desktop-amd64.iso.zs-old
-rw------- 1 nio nio 2741968896 aug 29 16:56 kinetic-desktop-amd64.iso
-rw------- 1 nio nio 1996488704 aug 31 07:14 focal-desktop-amd64.iso
lrwxrwxrwx 1 nio nio         30 sep  2 16:24 focal-desktop-amd64-old.iso -> focal-desktop-amd64.iso.zs-old
lrwxrwxrwx 1 nio nio         32 sep  3 08:18 kinetic-desktop-amd64-old.iso -> kinetic-desktop-amd64.iso.zs-old
lrwxrwxrwx 1 nio nio         30 sep  3 08:20 jammy-desktop-amd64-old.iso -> jammy-desktop-amd64.iso.zs-old

From mkusb-nox -h we conclude that the best option for a USB pendrive is

sudo /path/mkusb-nox file.iso

and for an SSD connected via a USB adapter is

sudo /path/mkusb-nox file.iso all

where all indicates that all /dev/sdx drives should be tested. Some of them are busy and therefore not available as target drives (automatically by mkusb-nox).

The first time you have to answer/confirm a few times to have a chance to double-check that it is the correct target device.


$  sudo mkusb-nox kinetic-desktop-amd64-old.iso all  # try all /dev/sdx drives
[sudo] password for nio: 
The iso file SHOULD BE loop mounted on a temporary file READ-ONLY:
mount: /tmp/tmp.3wJOrUv5Jo: WARNING: device write-protected, mounted read-only.
disk_name_type=debian
Ubuntu kinetic 22.10 amd64 i386  _found_ in iso-file
Ubuntu kinetic 22.10 amd64 i386  _not_ in USB device
Do you want to make a new one? (y/n)
y
***  WARNING: the device will be completely overwritten      ***
***  quit with (q)                                           ***
***  Unmount the device if mounted  ****************************
 
Name: ata-SanDisk_SD6SB1M256G1001  Dev: /dev/sda  Size: 256GB
Name: ata-WDC_WD4002FYYZ-01B7CB1   Dev: /dev/sdb  Size: 4001GB
Name: ata-OCZ-AGILITY3             Dev: /dev/sdc  Size: 60GB
Live drive: /dev/sda
 
#      would not unmount  /dev/sda because device is busy; in fstab
#      would not unmount  /dev/sdb because device is busy; in fstab
---> 1: install to Name: ata-OCZ-AGILITY3 Dev: /dev/sdc Size: 60GB
Go ahead with (g) or quit with (q). Toggle USB-only with (u).
g
1: source: kinetic-desktop-amd64-old.iso
   target: Name: ata-OCZ-AGILITY3             Dev: /dev/sdc  Size: 60GB
 Final checkpoint 
Please check again that it is the correct target device! (y/n)
y
 
Installing kinetic-desktop-amd64-old.iso to /dev/sdc ...
 
gpt_zap: done
< "kinetic-desktop-amd64-old.iso"  dd bs=1M  of=/dev/sdc status=progress oflag=dsync
Please wait for sync (flushing file system buffers to the device)
until 'Done' is written ...
2792142848 bytes (total size to be cloned)
2786066432 bytes (2,8 GB, 2,6 GiB) copied, 47 s, 59,3 MB/s 
2662+1 records in
2662+1 records out
2792142848 bytes (2,8 GB, 2,6 GiB) copied, 47,2723 s, 59,1 MB/s
Syncing the device ...
Done :-)

Only one (y/n) question when the target device is the same for a new daily iso file

mkusb-nox checks that a signature in the iso file matches that in the target device, and this reduces the effort, time and risk to a minimum:


$ sudo mkusb-nox kinetic-desktop-amd64.iso all  # try all /dev/sdx drives
The iso file SHOULD BE loop mounted on a temporary file READ-ONLY:
mount: /tmp/tmp.voPHvaQkPv: WARNING: device write-protected, mounted read-only.
disk_name_type=debian
Ubuntu kinetic 22.10 amd64 i386  _found_ in iso-file
Ubuntu kinetic 22.10 amd64 i386  _found_ in /dev/sdc
 Final checkpoint 
Install to /dev/sdc? (y/n)
y
dd if="kinetic-desktop-amd64.iso" of=/dev/sdc bs=1M status=progress oflag=dsync ...
2741968896 bytes (total size to be cloned)
2715811840 bytes (2,7 GB, 2,5 GiB) copied, 46 s, 59,0 MB/s 
2614+1 records in
2614+1 records out
2741968896 bytes (2,7 GB, 2,6 GiB) copied, 46,5443 s, 58,9 MB/s
The Ubuntu kinetic 22.10 amd64 i386  USB device is re-cloned  :-)
$ 

Links

Summary

This text will be hidden

6 Likes