How to Make a Linux USB Live Disk with the Terminal

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?

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.

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.

how-to-make-a-usb-live-disk-with-DD-and-the-terminal-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.

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

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.

how-to-make-a-usb-live-disk-with-DD-and-the-terminal-iso-command

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.

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.

how-to-make-a-usb-live-disk-with-DD-and-the-terminal-zero-drive

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.

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.

6 comments

  1. Derrik – double-check the OF (output) device in the example: you appear to be pointing to your “/home” partition that resides on /dev/sdb instead of the thumbdrive that appears to be on /dev/sdc in your pictured example. The DD command would essentially wipe your home directory and all the contents since you’re performing this as ROOT user!

    • I had just used SDC as an example, and showed the output of lsblk as an example. Maybe using X is a better example.

      And by the way, I know where my /home is. I set up Fstab manually on my machine.

      I’ll change the screenshot to reflect my example.

  2. In linuxmint 17, and many other distros, the command for getting the dev/sdX path should be lsblk not lsbk.
    I concur with Bill M.

  3. Hi Derrik,

    Per your snapshot I agree with both Bill M and Bill P, if you overwrite /dev/sdb, you will destroy your home directory. :D

    I’d suggest editing the article so some poor new guy doesn’t fall into that error.

    Cheers, Graeme.

  4. Help! New novice to the command line I do not understand where the bs=4m information came from. Have seen else where but can not get it explained. The rest is easy to understand I have seen it in other places but everyone skips the bs=x part and exlaination about it. no response. Losing hope. It feels like everyone in comments like to nitpick each other but ignore genuine new people. Sorry about showing my frustration. I am just trying to it my feet on the ground using this stuff.

    • “bs=4M” refers to the block size. It means the file size that the dd operation read/write at any time. If you don’t specify it, the default value is 512 bytes, and it would take a long time for a large file to finishing copying to the destination.

Comments are closed.

Sponsored Stories