How to create a bootable Linux USB flash drive from terminal?

Many Linux users might be using some tool to create bootable Linux USB sticks, but no one uses the traditional method which works flawlessly and I’m still using this method instead of relying on tools.

Let’s check out how to create a bootable Linux USB flash drive using the terminal. You can create any Linux USB drive in any flavor of Linux OS. All it needs is a working Linux OS and ISO file.

Startup disk creation for Linux

First download the ISO file of whatever Linux OS you want to make bootable on a USB stick drive.

Please note that this tutorial is only for Linux users and not for any other OS like MacOS or Windows.

Now attach the USB stick to the Linux computer and wait for the prompt. In some distribution it will auto mount and in some it will ask for your permission to mount. We’ll see this later…

Now search for the USB drive using the LSBLK command.

lsblk

It will show you all the connected drives and USB sticks. You need to understand which one is the USB stick you just attached. If not getting try removing the USB stick and retrying the command, attaching it again, and doing the command to see which new drive is added.

atulhost@debian: $ lsblk
NAME                SIZE  TYPE  MOUNTPOINTS
sda                 120G  disk
----sda1            120G  part
sdb                 16G   disk
----sdb1            16G   part
nvme0n1             512G  disk
----nvme0n1p1       1024M part  /boot/efi
----nvme0n1p2       4G    part  /recovery
----nvme0n1p3       504G  part  /
----nvme0n1p4       4G    part
    ----cryptswap   4G    crypt [SWAP]

In my case, it is showing sdb (16GB) with only one partition sdb1. In my setup, I have installed Linux on the NVME (nvme0n1) drive and have an additional SSD (sda) drive for backups.

If it is auto mounted then unmount the drive using the following command.

sudo umount /dev/sdb1

In my case, it was asking me to mount or not so I click no straight away, but in your case, things may go differently. So, there is no need to use the above umount command if the drive wasn’t auto-mounted.

You can then begin to create the bootable USB stick.

Creating a bootable Linux USB drive.

Open the terminal and type the command.

sudo dd if=debian.iso of=/dev/sdb status=progress

It will erase everything from the USB flash drive and start copying/mirroring ISO contents as it is on it.

Understand the command.

Here, IF means Input File; OF means Output File; and the status directive will show you the real-time progress of USB creation. If you do not use the status flag then it will not show anything but it will work in the background, and a new line prompt will only be available once done.

Once done, you can reboot the computer system and try to boot from the thumb drive.

Category: .

Leave a Reply

Responses

  1. Anatoly Spektor Avatar
    Anatoly Spektor

    Thanks Atul, I was looking for a tool and didn’t find any good one, but this made my day. Although I have to use command line but this article was so simple that I don’t think I need a tool for creating bootable drive.

    1. Atul Kumar Pandey Avatar

      Welcome Anatoly, glad to know that it worked for you. Good day.

%d