Linux users typically burned ISO files to a DVD or CD, but many computers no longer have a disk drive. Creating a bootable USB drive is a better solution. It will work on most computers and will start, run, and install faster.
How do bootable Linux USB sticks work?
Like a live CD or DVD, a bootable USB drive lets you run virtually any Linux distribution without affecting your computer. You can also install a Linux distribution on your PC from it – no CD or DVD drive required. However, you can not simply copy or extract the ISO file to the USB drive and expect it to work. Although, technically, you do not "burn" the ISO file on a USB drive, a special process is needed to extract a Linux ISO file and create a bootable USB drive.
There are two ways to do this: Some Linux distributions include a graphical USB startup disk creation tool that will do it for you. You can also use the dd command to do it from a terminal on any Linux distribution. Whichever method you choose, you will need the ISO file for the Linux distribution.
For example, Ubuntu Linux has two built-in methods for creating a bootable USB drive. A bootable USB drive offers the user the same experience as a Ubuntu Live DVD. It lets you try the popular Unix-like operating system without making any changes to the computer. When you are ready to install Ubuntu, you can use the USB drive as a support for installation.
You will need an Ubuntu installation ISO image to create the bootable USB drive. So make sure that downloaded the version of Ubuntu you want to use.
To be clear, this bootable USB drive will boot into a working copy of Ubuntu Linux but will not save any changes made. Every time you start Ubuntu from this USB key, it will be a new instance of Ubuntu. If you want to be able to save changes and data, you need to create a bootable USB drive with persistent storage. It is a more complicated process.
Although we use Ubuntu as an example here, it will work the same way with other Linux distributions.
How to graphically create a bootable USB stick
The default installation of Ubuntu includes an application called Startup Disk Creator, which we will use to create our bootable USB key. If you use another Linux distribution, it may include a similar utility. See the documentation for your Linux distribution – you can search for it online – for more information.
For Windows users, we recommend Rufus to easily create a live USB stick.
Warning: This will erase the contents of the target USB drive. To make sure you do not accidentally write to the wrong USB drive, we recommend that you remove any other connected USB drive before proceeding.
For Ubuntu, any USB drive of 4 GB or more should be suitable. If your ISO Linux of choice is bigger than that – most are not – you may need a larger USB drive.
When you are sure that the correct USB drive is the only one connected to your computer, start Startup Disk Creator. To do this, press the Super key (the Windows key of most keyboards) and type "Startup Disk". The Boot Disk Creator icon appears. Click on its icon or press Enter.
The main Startup Disk Creator window appears. The USB device will be highlighted in the lower pane.
Click the "Other" button. A standard open file dialog will appear. Navigate to the location of your Ubuntu ISO file, highlight it and click the "Open" button.
The main window of Startup Disk Creator should now look like the screen capture below. An ISO image must be highlighted in the upper pane and a USB key highlighted in the lower pane.
Confirm that the ISO image and the USB drive are correct. Click the "Create Boot Disk" button when you want to continue.
A warning appears to remind you that the USB drive will be completely erased. This is your last chance to go back without making any changes to the USB drive. Click the "Yes" button to create the bootable USB drive.
A progress bar tells you how close the creative process is.
A confirmation message appears to inform you of the completion of the bootable USB drive creation. On the computer we used for this article, the process took about five minutes.
Click on the "Quit" button. You can now restart your computer and boot from the USB drive or unplug the USB drive, transfer it to another computer and boot it to that location.
How to make a bootable USB stick with dd
The tool we will use to create the bootable drive from the command line is the dd command.
Warning: This command must be used very carefully. dd will do exactly what you tell him, as soon as you tell him. There are no questions "Are you sure" or chances to go back? dd is content to follow the instructions you gave him. So we have to be very careful about what we tell him to do, that's what we want him to do.
We need to know which device your USB stick is associated with. In this way, you know for sure the identity of the device to be passed to dd on the command line.
In a terminal window, type the following command. The lsblk command list block devices on your computer. Each drive is associated with a block device.
The output of lsblk will show the drives currently connected to your computer. There is an internal hard disk on this machine called sda and a partition called sda1.
Plug in your USB drive and use the lsblk command one more time. The output of lsblk will have changed. The USB drive will now be listed in the output.
There is a new entry in the list called sdb that contains two partitions. A partition is called sdb1 and its size is 1 KB. The other partition is called sdb5 and its size is 14.6 GB.
This is our USB key. The identifier we must use is the one that represents the drive, not one of the partitions. In our example, it is sdb. Regardless of how it is named on your computer, the device that was not in the previous list of lsblk must be the USB drive.
The command we will give to dd is:
sudo dd bs = 4M si = Downloads / ubuntu-19.04-desktop-amd64.iso from = / dev / sdb conv = fdatasync
Let us break that down.
sudo: You must be a superuser in order to run dd commands. You will be prompted to enter your password.
dd: The name of the command we use.
bs = 4M: The -bs (blocksize) option sets the size of each block read from the input file and writes to the output device. 4 MB is a good choice because it offers a good bit rate and an exact multiple of 4 KB, which is the block size of the ext4 file system. This gives an effective reading and writing rate.
if = Downloads / ubuntu-19.04-desktop-amd64.iso: the -if option (input file) requires the path and name of the Linux ISO image you use as input file.
of = / dev / sdb: The -of (output file) is the critical parameter. This must be provided with the device that represents your USB key. This is the value we identified using the lsblk command previously. In our example, it is sdb. So we use / dev / sdb. Your USB key may have a different identifier. Make sure you provide the correct identifier.
conv = fdatasync: The conv parameter specifies how dd converts the input file as it is written to the output device. dd uses kernel disk caching when writing to the USB drive. The fdatasync modifier ensures that write buffers are emptied correctly and completely before the creation process is reported complete.
There is no visual feedback from jj as the creation progresses. He gets to work and does not pay anything until the end.
When the bootable USB drive has been created, dd indicates the amount of data written to the USB drive, the elapsed time in seconds, and the average data transfer rate.
You can verify that the bootable USB drive works by restarting your computer and booting from the USB drive, or you can try booting from it on another computer.
You now have a portable working copy of Ubuntu or another Linux distribution of your choice. It will be blank at startup, and you can boot it on any PC of your choice.