How to Make a Linux USB Live Disk with the Terminal

Spread the love

When people install Linux these days, for the most part they’re doing it via a USB stick. There are a whole lot of graphical tools on Linux that can help with creating the live disk. These tools are all fine and everything, but what about a command line based option?

How to make a USB live disk with DD and the terminal

Making a USB stick is fairly easy in the command line. All it takes is a flash drive and a single command – the dd command to be exact. It’s a command specifically created for copying files.

Note: please make sure that your flash drive is formatted and all of the files are removed from it.

1. Open up a terminal window and enter the command below.

sudo dd if=isofile.iso of=/dev/sdX bs=4M

Are you not sure how this command works exactly? Well, for starters you need to change the /dev/sdX portion of the command to reflect your flash drive. To do that you’ll need to open a terminal and enter the command below.

lsblk

Once the command is entered, you’ll notice that all hard drive (and similar media) are listed. Using the list, determine which one your drive is. In this case, our USB drive is located at /dev/sdb.

When you’ve found what your device is and changed it in the command to reflect it, you’ll need to change the if=isofile.iso to reflect the changes. Make sure it looks something like this.

if=/path/to/iso/isofile.iso

For example, if your iso file is in the Downloads folder under your Home directory, here is the command:

sudo dd if=/home/username/Downloads/isofile.iso of=/dev/sdb bs=4M

Now that everything in the command has been configured, you can execute it. Please note, you’ll need to run this command as root or it won’t work.

The process will begin. It may take a while, and when you enter your command, you’ll just see the password prompt and nothing else. Don’t worry about that, its just dd doing its thing. After a while, you’ll see the terminal prompt exactly how much data was copied and at exactly what rate of speed. This means the creation has been successful.

How to restore your USB drive to normal

Want to put your USB drive back to normal? It’s pretty easy. Just open up a terminal and enter the command below. Soon after your drive should be back to normal.

Note: This command will zero your flash drive. You’ll need to use a partitioning tool like Gparted to create a new partition on it.

sudo dd if=/dev/zero of=/dev/sdb bs=1M

Like before, this command will take a while. Just be patient and soon the terminal will print out some details pertaining to what it just did. After that, you can take your favorite partitioning tool, create a new partition on your USB stick and everything will be back to normal.

Conclusion

I love making USB disks with the dd command. Why? It’s the most fool-proof way to create a live disk. I can honestly say that I’ve never had any issues using dd to create my live disks. I can’t say that I’ve had the same amount of success with other tools on Linux.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Derrik Diener

Derrik Diener is a freelance technology blogger.

Comments (6)