Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Make a Bootable USB from ISO in Linux Terminal

    How to Make a Bootable USB from ISO in Linux Terminal

    By RahulMarch 31, 20235 Mins Read

    Creating a bootable USB drive is an essential skill for every Linux user. A bootable USB drive allows you to install, test, or troubleshoot various Linux distributions without making changes to your existing system. In this in-depth guide, we will explore the tools and techniques used to create a bootable USB drive from an ISO file using the Linux terminal.

    Advertisement

    Prerequisites

    Before we begin, ensure you have the following:

    • A USB drive with at least 4 GB of storage capacity
    • An ISO file of the Linux distribution you want to make bootable
    • A computer running Linux

    Windows users read this: How to Create Ubuntu Bootable USB in Windows

    Step 1: Identifying the USB drive

    First, connect your USB drive to your computer. Open the terminal and use the lsblk command to list all connected storage devices:

    lsblk 
    
    Sample output:
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 238.5G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi └─sda2 8:2 0 238G 0 part / sdb 8:16 1 14.9G 0 disk

    Find your USB drive in the list, typically labeled as /dev/sda or /dev/sdb. Note the device name for later use.

    Step 2: Formatting the USB drive (optional)

    It’s a good idea to format your USB drive before creating the bootable media. This ensures a clean and error-free environment. You can format the USB drive using the mkfs command:

    sudo mkfs.vfat /dev/sdX  
    

    Replace /dev/sdX with the correct device name noted in Step

    For example, if your USB drive is listed as /dev/sdb, the command should be:

    sudo mkfs.vfat /dev/sdb 
    

    This command formats the USB drive using the FAT32 file system, which is compatible with both BIOS and UEFI boot modes.

    Step 3: Creating the bootable USB using dd command

    The dd command is a versatile and powerful utility for creating bootable USB drives. To use it, enter the following command in the terminal:

    sudo dd if=~/Downloads/ubuntu-20.04.3-desktop-amd64.iso of=/dev/sda bs=4M status=progress 
    
    Sample output:
    2173700096 bytes (2.2 GB, 2.0 GiB) copied, 133 s, 16.3 MB/s 517+1 records in 517+1 records out 2168455168 bytes (2.2 GB, 2.0 GiB) copied, 156.245 s, 13.9 MB/s

    Replace “~/Downloads/ubuntu-20.04.3-desktop-amd64.iso” with the actual path to the ISO file, and “/dev/sda” with the correct device name noted in Step 1. The “bs=4M” option sets the block size to 4 MB, which speeds up the process, while the “status=progress” option displays the progress.

    After executing the command, wait for the process to complete. It may take a few minutes.

    Step 4: Sync and eject the USB drive

    Once the dd command finishes, you need to synchronize cached writes to the storage device to ensure that all data is written correctly. Use the sync command to perform this action:

    sync 
    

    This command may take a few seconds to complete. After the sync command has finished, it’s safe to remove the USB drive from your computer.

    Step 5: Testing the bootable USB drive

    Now that you have created the bootable USB drive, it’s time to test it. Reboot your computer and access the boot menu or BIOS/UEFI settings. Change the boot order to prioritize booting from the USB drive. Save the changes and restart your computer.

    Your computer should now boot from the USB drive, allowing you to install, test, or troubleshoot the chosen Linux distribution.

    Alternative tools: WoeUSB and Ventoy

    Although the dd command is the most common method for creating a bootable USB drive, there are alternative tools available, such as WoeUSB and Ventoy.

    1. WoeUSB: WoeUSB is a user-friendly tool for creating bootable USB drives, especially for Windows ISO files. To install WoeUSB on Ubuntu, use the following commands:
      sudo add-apt-repository ppa:tomtomtom/woeusb 
      sudo apt-get update 
      sudo apt-get install woeusb 
      

      After installation, use the woeusb command to create a bootable USB drive:

      sudo woeusb --device /path/to/your/iso-file.iso /dev/sdX 
      

      Replace “/path/to/your/iso-file.iso” with the actual path to the ISO file, and `/dev/sdX` with the correct device name noted in Step 1.

    2. Ventoy: Ventoy is a powerful tool that allows you to create multiboot USB drives, enabling you to store multiple ISO files on a single USB drive and boot from any of them. To install Ventoy, download the latest release from the official website (https://www.ventoy.net/) and extract the archive. Open a terminal in the extracted folder and run the following command:
      sudo ./Ventoy2Disk.sh -i /dev/sdX 
      

      Replace /dev/sdX with the correct device name noted in Step 1. Once Ventoy is installed, simply copy ISO files to the USB drive using your preferred file manager. Ventoy will automatically detect the ISO files, and you can choose which one to boot from when starting your computer.

    Conclusion

    In this in-depth guide, we explored various tools and techniques to create a bootable USB drive from an ISO file using the Linux terminal. With this knowledge, you can easily create bootable USB drives for different Linux distributions or even Windows operating systems, making it a valuable skill for every Linux user.

    boot bootable command linux Ubuntu usb
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    cp Command in Linux (Copy Files Like a Pro)

    dd Command in Linux (Syntax, Options and Use Cases)

    Understanding 2>&1 in Bash: A Beginner’s Guide

    View 5 Comments

    5 Comments

    1. Jules Randolph on April 4, 2018 11:41 pm

      Hi ! Nice tutorial. I wrote a bash script ‘bootiso’ that does exactly that but with extra security guards !
      You can check it here: https://github.com/jsamr/bootiso.

      Reply
    2. Krista on July 17, 2017 2:21 am

      Good day – I am studying the command lines you wrote; I need one clarification about the /medma/USB path. Is that a directory that have to create or is this the same as /media/USB. If it’s the latter, how is that possible when the literature state that you mount a device on an empty directory?

      Reply
      • Rahul K. on July 17, 2017 7:42 am

        Hi Krista,

        It was a typo. I have corrected the commands.

        Reply
        • Krista on July 27, 2017 12:41 am

          Hi Rahul, thanks for clarifying this matter. Now the only roadblock that I am running up against is the command for make bootable USB. An error message is displayed, it reads – no directory slots | syslinux: failed to create ldlinux.sys. Any thoughts on this? The host laptop that is being used lubuntu, the iso image that was copied is ubuntu v16.04 and the USB drive is 8 GB.

          Reply
        • Krista on July 27, 2017 1:50 am

          Hello again, I was able to successfully follow your instructions until I got to make USB bootable. I received an error message, and it reads – no directory slots | syslinux : failed to create ldlinux.sys. What this is referring to? As for my host laptop, it’s lubuntu. A copy of ubuntu v16.04 was copied to an 8 GB USB drive

          Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.