HOEKSTRA.CO.UK

Here is how to quickly create a bootable USB stick using just the standard commands on the Linux command line: We use the dd command and write the .iso file directly to the root of the USB stick.

When you insert the USB stick, do not "mount" any of the partitions on it, even though you may be prompted to do so when you insert it into the computer. Do I need to remind you that you will lose all information on the USB stick after this operation, including any information of the partitions that previously existed on the USB stick? Linux will decide how to name the device that you have inserted into your computer's USB port. This naming depends on what device you already have attached to the computer. The best way to verify the new device's assigned name is to look at the system events log as soon as you have inserted it - simply run dmesg as a sudo'ed user:

gerrit@z2 ~/$ sudo dmesg
[360233.751522] scsi 0:0:0:0: Direct-Access     Netac    OnlyDisk         8.07 PQ: 0 ANSI: 4
[360233.751877] sd 0:0:0:0: Attached scsi generic sg0 type 0
[360233.756525] sd 0:0:0:0: [sda] 121610240 512-byte logical blocks: (62.3 GB/58.0 GiB)
[360233.757224] sd 0:0:0:0: [sda] Write Protect is off
[360233.757225] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
[360233.757927] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[360233.776709]  sda: sda1 sda2 sda3
[360233.776888] sd 0:0:0:0: [sda] Attached SCSI removable disk

In this case, Linux is now calling the USB stick "sda", which is short for "SATA Drive A". Think of this as a handle for the device, which can be referred to as a special device file called /dev/sda. You can peek at how this USB stick is partitioned with the help of the fdisk command, followed by the "p" instruction:

gerrit@z2 ~/$ sudo fdisk /dev/sda 
Bla bla bla...
Command (m for help): p 
Device     Boot   Start       End   Sectors  Size Id Type
/dev/sda1  *         64   5821311   5821248  2.8G  0 Empty
/dev/sda2          8460     18699     10240    5M ef EFI (FAT-12/16/32)
/dev/sda3       5824512 121610239 115785728 55.2G 83 Linux

Type "q" to quit.

​Here we can see that the USB stick has already been partitioned into 3 partitions, but you can ignore this since you are about to obliterate all of this.

Now copy your .iso file to the USB stick's device handle /dev/sda in a byte-wise fashion that ignores the niceties of file headers and file system formatting. Note that we do not write to one of the partitions such as /dev/sda1, /dev/sda2, etc, even though these partitions are on the USB stick, instead we write to the root, which, as we have discovered, is /dev/sda:

gerrit@z2 ~/$ sudo dd if=linuxdistro.iso of=/dev/sda bs=1M status=progress

5818548224 bytes (5.8 GB, 5.4 GiB) copied, 449 s, 13.0 MB/s

This can take a few minutes.

Test if the process was successful by mounting one of the partitions of the USB stick on a temporary mount point, /mnt/sda1. You should be able to see some "Linuxy" files listed, depending on your chosen Linux distro:

gerrit@z2 ~/$ sudo mkdir /mnt/sda1
gerrit@z2 ~/$ sudo mount /dev/sda1 /mnt/sda1
gerrit@z2 ~/$ ls /mnt/sda1
boot  casper  dists  EFI  efi.img  isolinux  md5sum.README  md5sum.txt  pool


You are now ready to boot your target computer up with this USB stick.