How to Burn an ISO File to a USB Drive in Linux
Linux users traditionally burned ISO files to DVD or CD, but many computers don’t have disc drives anymore. Creating a bootable USB drive is a better solution it’ll work on most computers and will boot, run, and install faster.
How Bootable Linux USB Drives Work
Like a live CD or DVD, a bootable USB drive lets you run practically 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. You can’t simply copy or extract the ISO file to the USB drive and expect it to work, however. While you don’t technically “burn” the ISO file to a USB drive, there’s a special process required to take a Linux ISO file and make a bootable USB drive with it.
There are two ways to do this: Some Linux distributions include a graphical USB startup disk creator tool that will do it for you. You can also use the
dd command to do this from a terminal on any Linux distro. Whichever method you choose, you’ll need the Linux distribution’s ISO file.
For example, Ubuntu Linux has two built-in methods for creating a bootable USB drive. A bootable USB drive provides the same experience to the user as an Ubuntu Live DVD. It allows you to try out the popular Unix-like operating system without making changes to the computer. When you are ready to install Ubuntu, you can use the USB drive as the installation medium.
You will require an Ubuntu installation ISO image to create the bootable USB drive, so make sure you have downloaded the version of Ubuntu you wish to use.
To be clear, this bootable USB drive will boot into a working copy of Ubuntu Linux but it will not save any changes you make. Each time you boot into the Ubuntu from this USB drive it will be a fresh 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. That’s a more complicated process.
Just insert the resulting USB drive into any computer and boot from the USB device. (On some PCs, you may also have to disable Secure Boot, depending on the Linux distribution you choose.)
While we’re using Ubuntu as an example here, this will work similarly with other Linux distributions.
How to Make a Bootable USB Drive Graphically
The default Ubuntu installation includes an application called Startup Disk Creator, which we shall use to create our bootable USB drive. If you’re using another Linux distribution, it may include a similar utility. Check your Linux distribution’s documentation you can search for it online for more information.
For Windows users, we recommend Rufus for creating a live USB drive the easy way.
Warning: This will erase the contents of the target USB drive. To ensure you don’t accidentally write to the wrong USB drive by mistake, we recommend removing any other connected USB drives before continuing.
For Ubuntu, any USB drive of 4 GB capacity or greater should be fine. If your Linux ISO of choice is larger than that most aren’t you may need a larger USB drive.
When you are sure that the correct USB drive is the only one connected to your computer, launch Startup Disk Creator. To do so, press the Super key (that’s the Windows key on most keyboards) and type “startup disk.” The Startup Disk Creator icon will appear. Click its icon or press Enter.
The Startup Disk Creator’s main window will appear. The USB device will be highlighted in the lower pane.
Click the “Other” button. A standard file open dialog will appear. Browse to the location of your Ubuntu ISO file, highlight it and click the “Open” button.
The Startup Disk Creator main window should now resemble the screenshot below. There should be an ISO image highlighted in the upper pane and a USB drive highlighted in the lower pane.
Confirm to yourself that the ISO image and the USB drive are correct. Click the “Make Startup Disk” button when you are happy to proceed.
A warning appears to remind you that the USB drive will be completely wiped. This is your last chance to back out without making any changes to the USB drive. Click the “Yes” button to create the bootable USB drive.
A progress bar shows you how close the creation process is to completion.
A confirmation message appears to let you know when the creation of the bootable USB drive has completely finished. On the computer we used for this article, the process took about five minutes.
Click the “Quit” button. You can now either reboot your computer and boot from the USB drive or unplug the USB drive, take it to another computer, and boot it there.
How to Make a Bootable USB Drive With dd
The tool we’ll use to create the bootable drive from the command line is the
Warning: This command must be used very carefully.
dd will do exactly what you tell it to, as soon as you tell it. There are no “Are you sure” questions or chances for backing out.
dd just goes right ahead and carries out the instructions you’ve given it. So we need to be very careful that what we tell it to do is definitely what we want it to do.
We need to know what device your USB drive is associated with. That way you know for sure what device identity to pass to
dd on the command line.
In a terminal window type the following command. The
lsblk command lists the block devices on your computer. Each drive has a block device associated with it.
The output from
lsblk will show the drives currently connected to your computer. There is one internal hard drive on this machine called
sda and there is one partition on it called
Plug in your USB drive and use the
lsblk command once more. The output from
lsblk will have changed. The USB drive will now be listed in the output.
There is a new entry in the list, called
sdb and it has two partitions on it. One partition is called
sdb1 and is 1 KB in size. The other partition is called
sdb5 and is 14.6 GB in size.
That is our USB drive. The identifier we need to use is the one representing the drive, not either of the partitions. In our example this is
sdb. Regardless of how it is named on your computer, the device that was not in the previous
lsblk listing must be the USB drive.
The command we are going to issue to
dd is as follows:
sudo dd bs=4M if=Downloads/ubuntu-19.04-desktop-amd64.iso of=/dev/sdb conv=fdatasync
Let’s break that down.
- sudo: You need to be a superuser to issue
ddcommands. You will be prompted for your password.
- dd: The name of the command we’re using.
- bs=4M: The
-bs(blocksize) option defines the size of each chunk that is read from the input file and wrote to the output device. 4 MB is a good choice because it gives decent throughput and it is an exact multiple of 4 KB, which is the blocksize of the ext4 filesystem. This gives an efficient read and write rate.
- if=Downloads/ubuntu-19.04-desktop-amd64.iso: The
-if(input file) option requires the path and name of the Linux ISO image you are using as the input file.
- of=/dev/sdb: The
-of(output file) is the critical parameter. This must be provided with the device that represents your USB drive. This is the value we identified by using the
lsblkcommand previously. in our example it is
sdb, so we are using
/dev/sdb. Your USB drive might have a different identifier. Make sure you provide the correct identifier.
- conv=fdatasync: The
convparameter dictates how
ddconverts the input file as it is written to the output device.
dduses kernel disk caching when it writes to the USB drive. The
fdatasyncmodifier ensure the write buffers are flushed correctly and completely before the creation process is flagged as having finished.
There is no visual feedback from
dd at all as the creation progress takes place. It goes to work and doesn’t report anything until it has finished.
When the bootable USB drive has been created
dd reports the amount of data that was written to the USB drive, the elapsed time in seconds and the average data transfer rate.
You can check the bootable USB drive works by rebooting your computer and booting from the USB drive, or you can try booting from it in another computer.
You now have a portable working copy of Ubuntu or another Linux distribution of your choice. It will be pristine every time you boot it, and you can boot it on practically any PC you like.