/artwork/mkusb128.png

mkusb - tool to create boot drives

Simple, safe, reliable

mkusb is a simple, safe tool to create a bootable drive from an iso image or a compressed image file. The bootable drive is a mass storage device: A USB drive, an internal drive, or an eSATA drive.

The tool provides a safe frontend to select the correct origin file and destination drive, to prevent mistakes that might overwrite the wrong drive. It uses dd under the hood.

Tutorials

See mkusb in action: Here are several quite good recent mkusb walk-through video tutorials.

Quick Start

1. Enable the Universe pocket of the Ubuntu Repositories. Some flavors of Ubuntu already have this enabled. Running this command won't cause any harm to those flavors.

  •  sudo add-apt-repository universe

2. Add the mkusb PPA

  •  sudo add-apt-repository ppa:mkusb/unstable
     sudo apt update

3. Install the mkusb packages from the PPA

  •  sudo apt install mkusb
    
     # OPTIONAL for installed systems
     # DO NOT use if booted from a LiveCD/LiveUSB
     sudo apt full-upgrade
    OPTIONAL - to make persistent live drives
     sudo apt install usb-pack-efi    

5. Download or view the detailed mkusb quick start manual pdf that leads users through safely using the software. There is also an alternate link.

  • /pictures/16-mkusb-quick-start-manual-12.png

WARNING: mkusb will overwrite the entire target device

All existing data on your USB device (or mass storage device) will be lost when you use mkusb to convert the device from storage into bootable media. mkusb clones the ISO 9660 file system with its content from the iso file, overwriting any existing filesystem and data.

To convert the USB (or mass storage device) from bootable back to ordinary storage, you must reformat it (make a new partition table and file system). Once again, all previous data or 'persistent' data will be lost.


Advanced usage

When to use (and not use) isohybrid

Cloning an iso file to a mass storage device makes a boot drive, provided it is a hybrid iso file, post-processed with isohybrid. See this link to the isohybrid sub-page

Isohybrid should be run only once, and many iso files are already treated before uploading to the internet. The Ubuntu iso files are already treated with isohybrid. Use isohybrid only, if the USB drive does not boot after installing using mkusb.

This method with dd has a high success rate. It is particularly good for pre-release testing and new releases, when the standard tools like Unetbootin might not be ready (if the configuration of the booting has been changed since the previous release).

Upgrade mkusb

Normally you want to keep and installed system up to date automatically, via a GUI application or the following command lines,

sudo apt update
sudo apt full-upgrade

Then all installed packages (from standard repositories and PPAs so also mkusb) will be upgraded.

But a live-only or persistent live system can be damaged by such general updates & upgrades. Instead it is recommended to keep most program packages as they are, and only upgrade packages when really necessary. The following command lines work, when you want to update & upgrade the program packages that belong to mkusb without affecting the other program packages.

sudo apt update
sudo apt install mkusb

/pictures/55-search-for-mkusb-in-dash-cropped-small.jpg

Command line syntax

You can use mkusb with an option and with a source file as parameter. You may find it more convenient than to use the graphical interface via [dash or a menu and] a desktop file.

mkusb file.iso

There are more details in

man mkusb

and at /advanced.

Using mkusb and mkusb-nox from the command line is described in more detail at /advanced

Autoclone

It is possble to autostart the shellscript autoclone in a persistent live drive with Lubuntu and mkusb to install an operating system automatically, which is convenient if you maintain several operatings systems at different places. autoclone is 'replacing' the interactive shellscript dus alias mkusb-dus, and calls the executing shellscript dus-live. See the following link,

How can I make a bootable, unattended USB restore disk?

Software Features

mkusb is a flexible set of tools. You can treat the collection as a single guided application, or you can call subordinate scripts directly, or you can let mkusb choose for you.

Examples:

mkusb           # Opens a GUI vs. Text selection dialog
mkusb-dus       # Opens a graphical file selection dialog
mkusb file.iso  # Skips file selection and opens a target selection dialog

dus-01-mkusb-text-mode_xterm.png

mkusb-dus: For Graphical Environments

  • Most Desktop users will want this version. 'dus' is an acronym: Do USB Stuff. It can create LiveUSB with and without persistence.

    Details about installation and other aspects of using mkusb via GUI are described at /gui /artwork/mkusb24.png

mkusb-nox: For Servers and Shell Environments

  • Most user without a GUI will want this. See the NOX Quick Start Manual. It can create LiveUSB with and without persistence.

mkusb-min: The smallest safety belt over dd

  • Useful for simple installs, mkusb-min is a small (5.4 kiB) shellscript, that is easy to read and understand. It needs no installation -- you can run the shellscript locally (in the current directory). See the detailed description. This script can only create LiveUSBs without persistence.

    However, the slightly larger (20kiB) mkusb-minp version can create LiveUSBs with persistence from iso files of Ubuntu 19.10 and Debian 10 and newer. See the detailed description.

mkusb-bas: When Nothing Else Works

  • There are some commands in mkusb, mkusb-nox and mkusb-min, which are not available in old or very small linux distros, for example Wary Puppy. A simple version based on version 7.4 is made for such cases - mkusb-bas. See this pdf manual. (Alternate link).

Additional Feature: mkusb-plug

mkusb-plug is a bash shellscript, that wraps a graphical user interface around

  • xorriso-dd-target to identify the target device via a plug-in test method. This is a very safe way to identify the target device.

  • mkusb-sedd to create standard cloned live and installer drives and also persistent live drives.

  • mkusb-tow to create Windows installer drives.

See details at /plug - wrapper shell-script with a GUI, can make persistent live drives via a new plug-in test method.

Additional Feature: mkusb-xscl

mkusb-xscl is a bash shellscript, that wraps a graphical user interface around xorriso-dd-target. It can help you manage all the options and save the settings, that work best for you.

See details at /xscl - wrapper shell-script with a GUI, manages all the options of xorriso-dd-target

Is Thunar cluttering your Desktop?

If the file manager alias file browser is automatically started when a partition is mounted, several windows might clutter the desktop when mkusb is working, particularly when creating a persistent live drive. In Xubuntu you can turn it off like this:

  • Open the file manager (Thunar)
  • Select 'Edit -- Preferences'
  • Select the tab 'Advanced'
  • Select 'Configure the management of removable drives'
  • Untick 'Browse removable media when inserted'
  • Close


Installation

mkusb releases

New: mkusb version 12 uses dus and guidus, the new user interface

dus and its graphical front end guidus is easy to use and to maintain.

Older Releases: mkusb versions 7-11 are deprecated. Find details about improvements and added features at /v7 /v8 /v9 /v10 /v11 /artwork/mkusb24.png

If you use mkusb, help test it!

  • Grab a tarball.
    Review the Testing Page to see how to provide feedback and report problems.
    Also report workflow issues that could be fixed by a new feature.

Ubuntu

Ubuntu users should use the #Quick Start section at the top of the page. Quick Start has easy, step-by-step instructions. Try it first.

If you encounter problems with the Quick Start instructions:

  • Ubuntu systems must enable the "Universe" pocket of the Ubuntu repositories in order to install the pv package (18.04 and older) and the wmctrl package. Some flavors of Ubuntu, including Kubuntu, Lubuntu, and Xubuntu already have Universe enabled. Other flavors should use the following command to enable Universe:

     sudo add-apt-repository universe
  • Use only versions of Ubuntu that are within their community support window (5 years LTS, 9 months non-LTS). After end of community support there will be no updates, not even security updates. If you waited too long and can no longer install programs from the Ubuntu repositories due to end of life, you can use a web browser to install mkusb-min and use it in a terminal window (or in text mode) to create a live system in a USB drive or memory card. This is more tedious than using the PPA, so don't wait until end of life.

Debian

How to install the ppa 'manually'.

Other linux distros

When a linux distro is getting close to end of life, please try to find a new version or another distro with support for a fair interval of time, and that works in the computer. After end of life there will be no updates, not even security updates, so the connection to internet is no longer secure.

If you can run a web browser, you can install mkusb-min and use it in a terminal window (or in text mode) to create a live system in a USB drive or memory card. This works, but is not very convenient, if you are not used to terminal windows and command lines.

Downloading and using mkusb-installer works with several linux distros (but is getting deprecated in favour of using tarballs). This method is independent of the Debian - Ubuntu tools for installation. It works with Ubuntu and Debian too, but lacks the automatic updating that comes with the PPA.

You can use mkusb to create a USB boot drive or a memory card with a new operating system to try (and install if it works well).

Windows Installation

Quick method to get a portable linux system

The 9W-DUS_i686.exe application provides a quick method to get a portable linux system with the tool dus (mkusb-dus). It can create persistent live systems in Ubuntu and Debian and systems developed from them. It can also be used for other system tasks and can be a first step from Windows. See this link,

Self-extracting image file: 9W-DUS_i686.exe

Win32 Disk Imager

Win32 Disk Imager is a cloning tool for Windows to make USB pendrives boot Ubuntu and other linux operating systems.


Description of the method and the tool

Warning about overwriting the target device

mkusb will 'use the whole device', actually only the head end (size of the iso file), but the rest of the device is not available. mkusb simply clones the ISO 9660 file system with its content from the iso file. This ISO 9660 file system works from CD/DVD disks, and also from USB drives. After using a USB pendrive like this, you make a new partition table and file system, if you want to use it for another purpose.

Help selecting the correct target device

The crucial task of mkusb was and is to help selecting the correct device and avoid overwriting other devices.

Doing the same thing many times

For the first time I was helping to test a new Ubuntu version (Lubuntu 12.04 LTS). After a while I wanted to make it simpler and safer to transfer the code to the USB pendrive.

The standard tools

The standard tools to create USB boot drives are described with more details at the following links,

https://help.ubuntu.com/community/Installation/FromUSBStick

https://help.ubuntu.com/community/Installation/iso2usb

Tools like Rufus and Unetbootin assume you have a USB drive partitioned with a FAT32 file system and pick the content (file by file) of the iso file and enter it into the FAT32 file system. They must also install a bootloader. This process is much more complicated and prone to problems than cloning an iso file or compressed image file. This is why they might not be ready for a new release (if the configuration of the booting has been changed since the previous release).

dd image of iso file to USB device safely

But I also read somewhere that it should be possible to boot from a direct image of the iso file. So I tried it with dd, the 'disk destroyer'. And it works, the computer boots from a USB device (pendrive, stick, flash drive, but also disk or SSD) just like it were from a CD drive. Also like a CD, it will be mounted read-only, so it cannot carry persistence.

Since dd is a bit risky, I made a shell-script, so that you get advice from a help text and need not run dd, but with support from the script to avoid writing to any wrong drive. The first time you must select the correct USB device, if more than one are connected. So it is safer and also much more convenient (but nothing is 100% safe).

I cloned ubuntu-12.04-desktop-amd64.iso this way, and the USB pendrive worked in both UEFI and CSM (BIOS) modes (but that version of Ubuntu has passed end of life now, and there are current versions with similar or better compatibility, that boot when cloned to a USB drive).

The block size 'bs=4096' is used, when mkusb calls dd under the hood. This was selected after testing different block sizes in different cases, when mkusb was new in April 2012. Software and hardware have been developed during five years, so I made a new test in June 2017, and found no reason to change the block size. There is a detailed description of the new test at this link,

My standard dd block size is bs=4096; Edit: New test

iso-testing mode

In mkusb version 11 and mkusb-nox the next daily build will automatically select the correct USB device (when it is inserted into the computer). So for the next daily builds it is safe and very convenient. This feature was removed in mkusb version 12 alias mkusb-dus.

Shell script

The shell-script mkusb has been updated and improved many times and will be updated again when necessary. It is now convenient to use also for one-off creations of USB boot devices from iso files and compressed image files and also to wipe the drives if necessary after the cloning. The shellscript can monitor the data transfer with pv, and suggests that you install it, if not available.

Persistent live systems

Most of the time it is enough with a live only USB pendrive and only a waste of effort to create a persistent live system. The cloning method of mkusb is very reliable and works with most linux distros. It needs hybrid iso files. But sometimes it is better to have a persistent live system, and beginning with version 10 mkusb can create such systems.

'mkusb/persistent' system in one single drive

This is a system that is prepared automatically by mkusb.

See the following sub-page for more details: /persistent

/pictures/persist-12-select-persistent.png

'Simple persistence' in two drives

This is a system that uses a cloned read-only boot drive (CD, DVD, USB) and another drive with partitions for persistence.

See the following sub-page for more details: /sp

Expansion and imaging from a compressed image file

mkusb can clone or flash complete installed systems from an image file file.img or a compressed image file file.img.gz or file.img.xz, for example

From mkusb version 10.6.6 there are built in functions, that make it possible to use this method not only with the MSDOS partition table but also the GUID partition table (GPT), where there is a backup table at the very end of the drive. The functions gpt_zap and gpt_fix are built into mkusb.

Check the download with md5sum

Remember to check with md5sum, that the compressed image file was downloaded successfully.

Re-use the pendrive

In order to re-use the pendrive after installing a linux operating system, it is usually enough to format it completely (including MBR) using gparted in linux or Disk Management in Windows. See details in this link.

Wipe the first megabyte or the whole device

Sometimes there are data on a USB drive, that make the operating system or some tool confused. In such cases it often helps to wipe the first megabyte, overwrite it with zeros. But it means that all data on the drive will be lost. See the following sub-page for more details.

/wipe

Wipe the whole device

To wipe-whole-device with mkusb is a very special task, that is not recommended except in very special situations. Other tools are better to wipe an entire HDD or SSD for example hdparm or DBAN.

/wipe#Wipe_the_whole_device

/pictures/dus-18-restore-to-standard-storage-device.png

/pictures/dus-17-wipe-1.png

Windows USB install drive

There is a new Windows installer via mkusb-plug that works well in 64-bit versions of Ubuntu with Windows versions 7, 8, 10, and 11. This method is also ported to mkusb-dus (version 12.5.7) using the same tool mkusb-tow.

The following [old] method works well both with 32-bit and 64-bit versions of Ubuntu, also older versions. This method is tested and works with Windows versions 7, 8, and early editions of 10. With 64-bit versions of Windows, the target drive will be able to boot and install in BIOS mode as well as in UEFI mode.

Reliable to extract via a tarfile

Sometimes in Ubuntu based 32-bit systems, it was not possible to extract the content from the Windows iso file directly to a USB pendrive. The files were not copied correctly (with any of the standard copying tools: cp, rsync, dd) in Ubuntu 16.04.1 LTS (the current Ubuntu version, when this feature was added to mkusb-nox). But it works in a reliable way to extract to a tarfile, and then extract from the tarfile to the USB pendrive.

Problem with the 4 GiB max file size in FAT32

Several (but not all) Windows 10 iso files released in October 2018, Win10_1809Oct_Language_x64.iso contain a version of the file install.wim with size > 4 GiB. It means that the previous method does not work because the FAT32 file system cannot manage it.

New method works with current versions of Windows

Another method is developed to work with the huge file install.wim. You can this method with Windows 7 - Windows 11.

mkusb-nox

mkusb-nox 11.1.2: added feature: make USB install drive for Windows.

See more details at /v7#Making_a_USB_drive_to_install_Windows

dus with guidus alias mkusb version 12

The two step extraction method is ported from mkusb-nox to dus, and lets you use a graphical interface for the user dialogue.

/pictures/dus-23-guidus-console_selecting_windows-boot-drive.png

The output into the console window is similar to that from mkusb-nox.

See the following screenshot and text dump, guidus-console_making_windows-boot-drive.png:

/pictures/dus-22-guidus-console_making_windows-boot-drive.png

See also this text dump with the whole output, which can be seen if you scroll the text in the console window:

/text-screen-dumps/dus-22-guidus-console_making_windows-boot-drive.txt


References

Screendumps were made with the previous and current versions of mkusb. There are (text) screendumps from previous versions, including the latest non-menu version 7, in the corresponding version of the quick start manual.

Screendumps that illustrate how to use mkusb:

Artwork subwiki page, a place for icons and misc stuff.

Win32 Disk Imager is a corresponding tool for Windows to make USB pendrives boot Ubuntu and other linux operating systems.

You find more and general information at https://help.ubuntu.com/community/Installation/FromUSBStick

This page grew from this Ubuntu Forums tutorial "Howto make USB boot drives".

mkusb (last edited 2021-10-16 22:34:24 by nio-wiklund)