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.
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-upgradeOPTIONAL - to make persistent live drives
sudo apt install usb-pack-efi
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.
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).
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
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.
There are more details in
and at /advanced.
Using mkusb and mkusb-nox from the command line is described in more detail at /advanced
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,
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.
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
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
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'
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.
If you use mkusb, help test it!
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.
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).
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,
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,
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,
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.
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
'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
the One Button Installer described at https://help.ubuntu.com/community/OBI
dd_blank-obi_7.8GB_32_LubuntuTrusty.img.xz from http://phillw.net/isos/one-button-installer/dd_images/
and compressed images with systems, that can boot both in UEFI and BIOS mode
dd_Ubuntu_16.04-gamma-UEFI-n-BIOS-4-pendrive-12GB.img.xz from http://phillw.net/isos/linux-tools/uefi-n-bios and
dd_Ubuntu_16.04-gamma-UEFI-n-BIOS-12GB.img.xz for solid state and hard disk drives
dd_text_16.04-UEFI-n-BIOS_2016-05-27_4-pendrive-7.8GB.img.xz mini system with a text user interface
dd_text_16.04-UEFI-n-BIOS_2016-05-27_intel-4-pendrive-7.8GB.img.xz mini system with a text user interface for Intel graphics
Look for newer versions of these compressed image files at http://phillw.net/isos/one-button-installer/dd_images/ and http://phillw.net/isos/linux-tools/uefi-n-bios
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 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.
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 and all editions of 10. 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 this method does not work because the FAT32 file system cannot manage it. Until this is fixed in mkusb-dus, you can
use mkusb-plug with the tool mkusb-tow. This works in both BIOS and UEFI mode also with secure boot.
use mkusb-dus with the same tool mkusb-tow. See this link.
use woeusb according to this link. This works in both BIOS and UEFI mode but not with secure boot.
do it yourself with detailed help at help.ubuntu.com/community/Installation/iso2usb/diy/windows-installer-for-big-files. This works in both BIOS and UEFI mode also with secure boot. It is actually the same method that is automated in mkusb-plug.
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.
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:
See also this text dump with the whole output, which can be seen if you scroll the text in the console window:
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:
- Pictures for a fast internet connection
- Links to individual pictures for a slow internet connection
- PDF slideshow of mkusb 10.1.1 in Ubuntu 14.04.2
- Pictures describing persistence
- Text screendumps showing the workflow
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".