There are some cases where you need to boot from a USB drive:
Creating a boot stick on a Linux system is quite easy. One can either use the command line tool ‘dd’ or one of many available GUI programs. The first solution is the most flexible one because ‘dd’ is already installed on most linux systems. However, it is also kind of dangerous if you do not watch out what device you flash. One can easily erase the own hard drive by mistake. So I also show you the GUI program Etcher which takes care you write to your USB drive or SD card.
The ‘dd’ command is used to convert or copy files. Sometimes it’s referred to as ‘disk destroyer’… because one can easily erase the hard drive by mistake. Here is the basic syntax:
dd if=/path/to/inputfile of=/path/to/outputfile
The input is specified by ‘if=’ and the output by ‘of=’. In our case ‘if’ is the .img- or .iso-file (for example ubuntu.iso), ‘of’ is the USB drive.
Find the correct drive. This is extremely important! If you flash the wrong device you can erase your own hard drive! To find the name of your USB drive use the command:
sudo fdisk -l
In the following ‘/dev/sdb’ is used as an example. Make sure you use your own device!!
Make sure the drive is not mounted and then flash your USB drive. In my case the USB drive is ‘/dev/sdb’ and the command to flash it is:
sudo dd if=/home/simon-cybersec/images/ubuntu-2204.iso of=/dev/sdb bs=1M && sync
Here the option ‘bs’ is specified in order to write one megabytes at a time. ‘sync’ makes sure all the data in the buffer is written to the device.
This step might take some time. Be patient.
When it’s done you can boot from the USB drive.
Etcher is a tool for flashing USB drives or SD cards and is available for Linux/Windows/Mac. It takes care that you don’t override the hard drive. Download it from the official website.
One file will be downloaded. In my case it is named balenaEtcher-1.7.9-x64.AppImage. First make it executable by typing:
chmod +x balenaEtcher-1.7.9-x64.AppImage
Then execute it:
Etcher looks like this:
Select your .iso- or .img-file you want to flash to your drive. Then select your USB drive and click ‘Flash!’.
Congrats, you did it!
In order to boot from the created USB drive plug it into your computer and reboot. During the boot enter the BIOS/UEFI-BIOS. How to enter the BIOS is different for every manufacturer, so just do a quick google search about your computer. In the BIOS change the boot order in such a way that the USB drive is booted before the hard drive. Save and exit the BIOS. Now you can run your operating system from the USB drive!