NOTE: This is a demo for the DDs who shall approve the program as Debian package and official advice for users. The program is a /bin/sh script, written to the best knowledge of the developer of xorriso, which packs up the ISO images in question.
An alternative to the proposal of using "cp" or "dd" at https://www.debian.org/CD/faq/#write-usb
Copying a Debian hybrid ISO safely onto a USB flash drive
Several of the Debian and Debian Live images, notably all i386, amd64 and arm64 images, are created using the isohybrid technology and thus may be written to USB flash drives, bootable directly from the BIOS / EFI firmware of most PCs.
In general you need to unmount all mounted filesystems of the target device and then to plainly copy the image file bytes onto the device, without using any of its partitions or filesystems.
This article shows how to do this by assistance of program xorriso-dd-target in order to minimize the risk of overwriting the wrong storage device.
Identify the device by plugging and copy if it looks safe enough
On a GNU/Linux machine, install package xorriso-dd-target, or download and and give x-permission to https://dev.lovelyhq.com/libburnia/libisoburn/raw/master/xorriso-dd-target/xorriso-dd-target
The program will not overwrite the flash drive if it contains filesystems other than VFAT and ISO 9660. In this case you will not be done at the end of this chapter but will have to go on with the next one.
Have the USB flash drive unplugged and start the program with e.g
xorriso-dd-target -with_sudo -plug_test -DO_WRITE -image_file "$file"
You will probably be asked by program sudo for your password. sudo power will only be used with runs of programs lsblk, umount, and dd.
Testing sudo to possibly get password prompting done now: [sudo] password for thomas: sudo /bin/lsblk seems ok.
Alternatively you may run the whole program with superuser authority and without option -with_sudo.
Dialog step 1 is to confirm that the drive is really not plugged in. Your still attached drives will be registered as unwanted for copying.
Step 1: Please make sure that the desired target device is plugged _out_ now. If it is currently plugged in, make sure to unmount all its fileystems and then unplug it. Press the Enter key when ready. Found and noted as _not_ desired: sda sdb sdc
Step 2 asks you to plug in the drive and to press Enter again. Wait with the key press until you expect that the drive has been recognized by the operating system. After the key press the program looks for a drive which is not in the list of unwanted drives.
Step 2: Please plug in the desired target device and then press the Enter key. Waiting up to 10 seconds for a new device to be listed ... found: sdd Now waiting 5 seconds to let it settle ......... Found and noted as desired device: sdd
If the drive is recognized as the only new device and looking suitable for being entirely overwritten, you will see a line like
sdd : YES : usb+ has_iso9660+ has_vfat+ : Intenso Ultra Line
Dialog Step 3 asks you to enter the word "yes". The program will then try to unmount possibly automatically mounted filesystems. In case of success it will copy the image file onto the flash drive. This will overwrite the drive's old partition table and substantial parts of its content.
Step 3: Last chance to abort. Enter the word 'yes' to start REAL WRITING. yes Looking for mount points of sdd: /dev/sdd1 on /mnt/iso type iso9660 (ro,relatime) /dev/sdd2 on /mnt/fat type vfat (rw,...,errors=remount-ro) Unmounted: /dev/sdd1 Unmounted: /dev/sdd2 Performing: sudo /bin/dd if=/dev/zero of=/dev/'sdd' bs=512 seek='245759999' count=1 status=none sudo /bin/dd if='debian-10.0.0-amd64-netinst.iso' bs=1M of=/dev/'sdd' status=progress oflag=dsync ; sync
The first dd run writes zeros into the last block of the drive in order to invalidate a possibly present GPT backup table. It might get omitted if program "expr" on an old 32 bit system cannot cope with large numbers.
The second dd run copies the ISO image to the drive. If dd is young enough, options status=progress oflag=dsync get added to the dd command to let it print progress messages at realistic speed.
If the drive does not look safe for being overwritten, then the program refuses instead of performing step 3, unmounting, GPT backup zeroing, and copying. The reason of refusal in this case is the presence of an ext2 filesystem.
sdd : NO : usb+ has_iso9660+ has_vfat+ has_ext2- : SanDisk Cruzer NO CANDIDATE FOR TARGET DEVICE AMONG THE GIVEN NAMES ! Overall available devices: sda : NO : not_usb- has_vfat+ has_ext4- : ATA Samsung SSD 850 sdb : NO : not_usb- has_swap- has_ext4- : ATA WDC WD20EFRX-68A sdc : YES : usb+ has_iso9660+ has_vfat+ : Intenso Ultra Line sdd : NO : usb+ has_iso9660+ has_vfat+ has_ext2- : SanDisk Cruzer
How to overwrite a drive against the will of xorriso-dd-target
If anything looks suspicious, the program will refuse to unmount and to overwrite. You may ask it then for a detailed assessment of the drive and for showing the shell commands which it does not dare to perform.
xorriso-dd-target -with_sudo -dummy_force -list_long -image_file "$file" sdd
will report something like
sdd : NO : usb+ has_iso9660+ has_vfat+ has_ext2- NAME SIZE FSTYPE TRAN LABEL sdd 3.8G iso9660 usb d-live 9.5.0 xf i386 |-sdd1 1.9G iso9660 d-live 9.5.0 xf i386 |-sdd2 320K vfat `-sdd3 512M ext2 Overriding any advice because of -dummy_force Looking for mount points of sdd: /dev/sdd1 on /mnt/iso type iso9660 (ro,relatime) /dev/sdd2 on /mnt/fat type vfat (rw,...,errors=remount-ro) /dev/sdd3 on /mnt/ext type ext2 (rw,relatime) AGAINST THE ADVICE BY THIS PROGRAM, a daring user could do: sudo /bin/umount /dev/sdd1 sudo /bin/umount /dev/sdd2 sudo /bin/umount /dev/sdd3 sudo /bin/dd if=/dev/zero of=/dev/'sdd' bs=512 seek='7864318' count=1 status=none sudo /bin/dd if='debian-10.0.0-amd64-netinst.iso' bs=1M of=/dev/'sdd' status=progress oflag=dsync ; sync BE SMART. BE CAUTIOUS. BEWARE.
Now it is up to you to judge whether you want to perform the five shown sudo commands.
Details and more use cases are given by
(download: https://dev.lovelyhq.com/libburnia/libisoburn/raw/master/xorriso-dd-target/xorriso-dd-target.1 then run: man ./xorriso-dd-target.1)
lsblk and bootable ISOs on USB stick
The assessment of devices and filesystems is done by program lsblk. See
A known problem of younger lsblk with bootable ISOs on USB stick is that filesystem type and label of the ISO is falsely reported with partitions without filesystem or with empty label text:
NAME SIZE FSTYPE TRAN LABEL sdd 3.8G iso9660 usb d-live 9.5.0 xf i386 |-sdd1 1.9G iso9660 d-live 9.5.0 xf i386 |-sdd2 320K vfat d-live 9.5.0 xf i386 `-sdd3 512M ext2 d-live 9.5.0 xf i386
This was caused by a udev rule which is now fixed upstream by https://github.com/systemd/systemd/commit/19212f27816686a5cac2c965301cea8624ac467f and hopefully will be fixed at latest in Debian 11.
The effect on xorriso-dd-target is only cosmetic and does not affect the safety of drive evaluation.