Saturday, April 20, 2024
HomeTutorialsHow to Create a Linux Bootable USB Flash Drive

How to Create a Linux Bootable USB Flash Drive [Tutorial]

Whether you are a Linux newbie or a professional admin, having a Linux bootable USB can be handy in a number of situations. It allows users to experience modern Linux distributions without having to install them on their machine first. Luckily, creating a Linux live USB is not that much of a hard job. In this guide, we will present you with several ways to create one for yourself. We are not going to cover some of the advanced features like adding persistence or encryption, though. Nevertheless, this guide should be able to get you started and start experimenting on your own.

How to Create Linux Bootable USB Drives?


You can create a Linux live USB by using either a GUI application like Rufus or by leveraging your existing command-line utilities. We will show you how to create a bootable Linux distro from all major operating systems, including Linux, Mac OS, and Windows. Use the sidebar to jump directly to the section that discusses this for your OS.

The Fundamentals Behind a Live USB Installer


Before moving on to showing how to create your own live USB, we want you to understand the workflow behind it. Linux distributions roll out their latest versions as an ISO image. It contains the data required to boot into and install a fresh copy of that particular distribution.

Linux live USB

To create a live Linux stick, you will need to grab the ISO image of your preferred distribution. This can be done by going to the download page and downloading the ISO image onto your computer. Once this step is done, you will need to ‘write’ the contents of the ISO file to your USB stick. Moreover, The USB device must be formatted properly.

1. Create a Linux Live USB from Linux


If you are already using Linux, then it is very to create a new live USB. This can be useful if you want to try a new variant of Linux or need a secondary backup distribution. You can create a live USB directly from your Linux terminal emulator or via using a GUI application. For this tutorial, we will assume you are on a Ubuntu or similar distribution. However, the instructions are the same for all major Linux variants.

How to Create a Linux Bootable USB Using the GUI

Linux users can easily create live Linux installation media using the ‘Startup Disk Creator’ application. It is a simple but robust GUI tool that creates bootable USB devices for a walk in the park. Moreover, it comes pre-install to new Ubuntu systems by default. You can download ‘Startup Disk Creator’ for other distros from this page.

Step – 1: Insert the USB Stick

Once you insert the USB stick into your Linux machine, the system may show a prompt. Select ‘Do Nothing’ in this prompt. Open up your Linux file manager and inspect if your machine has recognized the USB. Move to the next step once everything appears to be as expected. Your USB device should be at least 4 GB or more in size.

Step – 2: Launch Startup Disk Creator

You can launch the Startup Disk Creator utility by opening your application dashboard or searching from the activities window.

launch startup disk creator

Step – 3: Select the ISO File

We are assuming that you have already downloaded the ISO file of your chosen distribution. Now it is time to select this image from the Startup Disk Creator. If you place the ISO file in the ~/Downloads folder of your Linux file system, Startup Disk Creator can detect it automatically. Otherwise, use the ‘Other‘ option of Disk Creator to select the appropriate location.

select ISO and USB

Step – 4: Select the USB Device

You should see a list of available USB devices under the ‘Disk to use:‘ option of Startup Disk Creator. Make sure to select the appropriate USB device because Disk Creator will overwrite the USB device in the following step. Backup any data you may have stored on the drive to your PC first. Then proceed with the operation by clicking the ‘Make Startup Disk’ option.

Step – 5: Confirm the USB Device

Ubuntu will prompt you to confirm the USB device once you have approved the writing process in the earlier step. As soon as you confirm the USB device, the writing process will begin, and Startup Disk Creator will start cloning the ISO data to the USB device.

confirm installation

Step – 6: Enter Password if Prompted

If you perform the write operation from a normal user account, Ubuntu will ask you for the user password. This is since writing an ISO to a USB device is an important decision. Once you enter the correct password, the write operation will start.

Linux live usb completed

If everything goes alright with the write operation, the installation will be complete. This can take anywhere between 5-15 minutes, depending on the USB device and the size of the ISO file. Once the ISO installation finishes, you can use your newly created Linux bootable USB to boot into a live distribution.

How to Create a Linux Bootable USB Using the Terminal

You do not need to use any GUI tool for creating live Linux USBs. You can easily create one using command-line utilities like dd and mkusb. The following section will show how to use Linux’s dd utility for creating a bootable Linux installation media.

Step – 1: Insert the USB Stick

Insert the USB stick to your machine as you would usually do. Select ‘Do Nothing‘ if Ubuntu or your current distro displays a prompt. Verify your USB device by typing the following command in your Linux terminal emulator.

$ sudo lsblk

It should be something like sdX, where X is another lowercase letter. Note the device name correctly else;, you might ruin the data contained by other storage devices.

Step – 2: Unmount the USB Device

Before you proceed to write the ISO file, make sure the USB device is unmounted. This can be done very easily by issuing the following command.

$ sudo umount /dev/sdX

Make sure you use the appropriate name for your USB device. Go to the next step once the USB stick is unmounted successfully.

Step – 3: Write the ISO File to USB

We will use the ‘dd’ utility for writing the ISO file to the USB device. It is a simple but extremely powerful Linux utility that is used for copying and converting files. Simply fire up a terminal session and enter the following command to start writing the ISO.

$ sudo dd if=/path/to/ubuntu.iso of=/dev/sdX bs=4M && sync

Replace the argument after ‘if=’ to point to the location that contains your ISO file. Change the device name (the part after ‘of=’) accordingly. Ensure the output name does not contain any letters (like /dev/sda1 or /dev/sdb1). They reflect partitions, not the device itself, which is needed for dd.

The sync bit is also important. If you omit it, dd might return before the write operation completes. Now, the write operation will start to take place. Your terminal session may appear frozen during the operation.

Do not interrupt it, or else you might end up with a broken installation. Once the data is written successfully, dd will return. You can now unplug your USB and use it as bootable media.

2. Create a Linux Live USB Drive from Mac OS


You can create a bootable Linux drive from Mac OS. However, you will need to perform some extra operations to ensure the live USB is fully compatible with your Apple hardware. First of all, you will need the USB device and the ISO image of your preferred Linux distribution.

How to Create a Linux Bootable USB Using the GUI on Mac

Users of Apple’s Mac OS can easily create Linux installation media using Etcher. It is a simple and powerful GUI tool that makes creating bootable USB devices easier for beginners.

Step – 1: Prepare the USB Device

To prepare the USB stick for a live Linux USB, first, reformat the device using Apple’s ‘Disk Utility’ application. You can open ‘Disk Utility‘ by going to the ‘Applications>Utilities’ menu or using Spotlight search. Once the application is opened, insert your USB device and inspect whether it has been added to Disk Utility. Make sure to enable the option ‘View>Show All Devices’.

prepare usb for etcher

Now, select your USB stick and click on the ‘Erase’ option from the toolbar to start reformatting your device. Set the format option of the USB drive to MS-DOS (FAT) and the scheme option to GUID Partition Map. Check if everything is selected appropriately, and then click on ‘Erase’.

Step – 2: Install and Open Etcher

We will make use of free and open-source software called Etcher for creating our bootable USB drive. You can download Etcher for Mac from its download page. Once the package has been downloaded and mounted, you can run it in-place or drag it to the Applications folder. Since recent versions of Mac OS blocks applications from unidentified developers, you may need to click on the ‘Open Anyway’ option to run Etcher.

install and open Etcher

Step – 3: Configure Etcher for ISO Installation

The Etcher workflow consists of three stages. First, you need to select the ISO file. Simply click on the ‘Select image’ option, and Etcher will provide a file explorer that can be used to locate and select the ISO image. Once this is done, click on ‘Select drive’ and select your USB device. Etcher will select the USB device automatically if one is already connected.

configure etcher for Linux bootable USB

Once the above two stages are completed, you can click on the ‘Flash‘ option. This will start the writing process and will ask you for your user password.

Step – 4: Wait Till Etcher Finishes

After you have entered your password, the flash process will begin. Etcher will display the writing progress, speed, and the estimated duration to complete. Once the ISO has been flashed, Etcher will perform a validation operation to check whether the data contained in the USB device is the same as the ISO. Your Linux bootable USB drive is ready to boot after this step completes successfully.

writing ISO using Etcher

Step – 5: Booting into Live Linux on Mac

To boot into a Linux installation media from Mac, you will need to restart your device and press the Option/alt (⌥) key. Make sure the USB device is inserted while doing this. It will launch the ‘Startup Manager’ and display a list of bootable devices connected to your Apple machine. The live USB should be labeled as ‘EFI Boot’ and usually appears in a gold or yellow color. Select this device, and it will start booting into the Linux distribution.

boot into linux live usb

How to Create a Linux Bootable USB Using the Terminal on Mac

If you are an advanced user, you might want to create your live USB from the terminal. Follow the below steps to create your live installation media using the Mac terminal successfully.

Step – 1: Convert the ISO File to IMG File

To create a live USB from the terminal, you will need to convert the ISO image of your chosen Linux distro to an IMG file. This can be done by using the hdiutil tool. Simply fire up a terminal session and issue the following command.

$ hdiutil convert /path/to/ubuntu.iso -format UDRW -o /path/to/target.img

OS X often appends the .dmg extension after the output image. However, you do not need to worry about that since it will not affect the installation.

Step -2: Determine the USB Device

You need to determine the device node assigned to your USB stick before you can write the target image to it. You can do it by running the following command.

$ diskutil list

This will show a list of currently connected devices. Now, plug in your USB device and rerun the command. Compare the output of the two commands to determine the device node.

Step – 3: Unmount the USB Device

Before you start to write the IMG file, make sure to unmount the USB drive. You can easily do this by issuing the following command.

$ diskutil unmountDisk /dev/diskX

You need to replace X with the disk number of your device. You should have this information from completing step number two.

Step – 4: Write the IMG File to USB

Now that we have converted the ISO file and unmounted the USB device, we can create the Linux bootable USB. Enter the following command in your terminal session to start the writing process.

$ sudo dd if=/path/to/target.img of=/dev/diskX bs=1m

Make sure to replace the input file’s location with the actual location of the target.img file. Also, replace /dev/diskX with the actual disk number of your device. Moreover, if you see the error “dd: Invalid number ‘1m'”, then you are using the GNU dd instead of BSD dd. Simply replace 1m with 1M to mitigate this issue.

Pro Tip: Using /dev/rdiskX in place of /dev/diskX will make the writing process much faster!
Step – 5: Eject and Remove USB Device

Once the write operation finishes, eject the USB device by running the following command.

$ diskutil eject /dev/diskN

Remove the USB when this process is finished. Now you can restart your Mac and boot into the Linx live distro. Press the Option/alt (⌥) key while the USB is inserted for launching the ‘Startup Manager’. The live USB should be labeled as ‘EFI Boot’. Select this device, and it will start booting into the Linux distribution.

3. Create a Linux Live USB Drive from Windows


You can create a live Linux installation media on Windows using a GUI toolkit like Rufus or via the command prompt. The following sections discuss both of these. We are assuming you are on Windows 10. However, these methods should also work the same for Windows 8.

How to Create a Linux Bootable USB Using the GUI on Windows

We will use Rufus for creating a live Linux USB from Windows. You can download Rufus from its website. Install it once the download finishes and follow the below steps.

Step – 1: Select USB Device

To select the USB device, launch Rufus, and insert your USB. Rufus should detect the device automatically. In case there are multiple USB devices connected to your machine, select the appropriate one from the Device field. We recommend users to unplug all other USB devices to make this step hassle-free.

rufus usb selection for Linux live USB

Step – 2: Select Boot Options and Partition Scheme

Once you have selected the right USB device, go to the ‘Boot selection’ menu. Here you will find two options – ‘FreeDOS’ and ‘Non Bootable’. Select FreeDOS and move on to the next options. Both the ‘Partition scheme’ and ‘Target system’ options should be selected automatically by Windows.

rufus boot partition selection

Step – 3: Select the ISO File

Given you have already downloaded the ISO file of your preferred Linux distro, select it by clicking the ‘SELECT‘ button. It will open the file explorer that can be used to browse the file system and locate the ISO. Mark the appropriate ISO image and click ‘Open‘ to select the ISO.

rufus ISO selection

Step – 4: Write the ISO File

Once you have selected the ISO file, the Volume Label will be updated accordingly. Leave all other fields as they are and click on START to begin the writing process.

Start ISO Writing on Rufus

Step – 5: Approve Additional Downloads and Warning

Rufus may need to download some modules to complete the writing process. Approve any such requests by clicking on the Yes button. Rufus will show another prompt with some warnings related to ISOHybrid images.

Keep the recommended options(Write in ISO Image mode) and click Ok. The next screen will ask for confirmation regarding the USB write process. Enter OK to continue the installation.

confirm additional downloads for rufus

If you get any more warnings, approve them as well. If everything goes alright, Rufus will start copying the contents of the ISO image to the USB device. You can view the progress in the lower right corner of the window.

It can take up to 15 minutes to complete the process. Once Rufus finishes, the progress bar will turn green and display the text ‘READY‘. Your live USB is now ready to boot.

Complete Linux Bootable USB Writing

How to Create a Linux Bootable USB Using the Windows CMD Prompt

You can also create the live Linux media using the CMD prompt of your Windows machine. Follow the below steps to do this. Make sure you have already downloaded the ISO file of your chosen Linux distribution.

Step – 1: Insert USB Device

Insert the USB device to your machine and select do nothing if a prompt appears. The device should have at least 4 GB of free space available to it. Try plugging the USB device into a high-speed port for faster writing.

Step – 2: Run DISKPART

DISKPART is a command-based Windows tool for disk partitioning. Open your CMD prompt as administrator and run the following command to invoke DISKPART.

C:\Windows\system32> diskpart
Step – 3: List Available Disks

Once DISKPART is open, use the below command to display all the available disk drives.

DISKPART> list disk

This will show a list of disks. You can determine your USB stick by looking at the column that’s labeled size.

Step – 4: Select USB Device

Now, you need to select your USB device so you can format it. Enter the following command in your DISKPART prompt.

DISKPART> select disk X

Replace X with the disk number of your USB device. Once you do this, DISKPART will select your USB device for further configuration.

Step – 5: Create Primary Partition

Before creating the primary partition for your USB, clean the device by issuing the following command.

DISKPART> clean

Once DISKPART completes the cleaning process, issue the following command to create the primary partition.

DISKPART> create partition primary
Step – 6: Select and Activate the Partition

After you have created the primary partition, you need to select and activate it. You can do this by running the following commands in your CMD prompt.

DISKPART> select parition X

Replace X with the appropriate partition number and proceed to the next command.

DISKPART> active

This will make the selected partition active.

Step – 7: Format the Partition

Now you need to format the selected partition. You can do this by running the following command in your DISKPART prompt.

DISKPART> format fs=ntfs quick

This can take somewhere between 10 to 15 minutes, depending on the write speed of your USB device and port. Once this step is finished, you need to add a drive letter to it.

Step – 8: Assign Drive Letter
DISKPART> assign

DISKPART will now assign a drive letter to your USB device. We will assume it’s U:\ for the rest for this guide. Yours will differ, so take note of it carefully. Once this is done, you can quit DISKPART by issuing the following command.

DISKPART> exit
Step – 9: Mount the ISO Image

To copy the contents of the ISO image to your newly partitioned USB device, you will need to mount it to the file system. Run the following command in your CMD prompt to start mounting the ISO.

C:\Windows\system32> PowerShell Mount-DiskImage

After a few seconds, PowerShell Mount-DiskImage will ask for the path to the ISO file. Supply the appropriate path in the input field to mount the ISO image.

ImagePath[0]: c:\isoimages\linux\ubuntu.iso

This will mount the ISO file to your Windows file system. Make sure to use a path that reflects the location of your ISO file. It will be assigned a new drive letter. We will assume it is V:\ for the rest of this tutorial.

Step – 10: Copy the contents of the ISO

Now that’s everything is configured, we are ready to copy the contents of the ISO image to the USB device. Use the following command to do this from your CMD prompt.

C:\Windows\system32> XCOPY V:\*.* /s /e /f U:\

Make sure you are using the right drive letters before you run this command. Replace U:\ with the drive letter assigned to your USB drive and V:\ with the letter assigned to your ISO drive. Once copying is finished, you can quit the CMD prompt and use the live Linux USB for booting into your new Linux distro.

Ending Thoughts


In this guide, we have demonstrated how to create a Linux bootable USB using both the GUI and the command-line. We have shown the required methods for all major operating systems, including Linux, Mac OS, and Windows. So no matter what device you’re on, you should be able to create a Linux live USB without any trouble.

Note that some of the steps may differ slightly if you are using an older version of your current OS. Moreover, we highly recommend users to check the appropriate location of the USB device before confirming the writing process. Else, you may overwrite a different portion of your storage device.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.

1 COMMENT

  1. Thank you for a great explanation!
    However can you p,lease add to it how to add persistence to this live USB installation?

Comments are closed.

You May Like It!

Trending Now