mkusb - tool to create boot drives
Simple, safe, high success rate
The mkusb tool was developed to make it simpler and safer to create boot drives with the method to flash or clone an iso image or a compressed image file. It is using dd under the hood.The target is a mass storage device, often but not always a USB drive, sometimes an internal drive or an eSATA drive.
This wiki page will exist alongside the Ubuntu Forums tutorial "Howto make USB boot drives".
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).
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.
Quick start manual and mkusb PPA
The fastest way to start making and repairing USB boot drives is to install the mkusb PPA, install and update the mkusb package like all the other program packages.
Normally the package mkusb-common will be installed automatically, but due to upgrading from mkusb version 11 to mkusb version 12 with another structure, it is best to specify mkusb-common on the command line.
You find the PPA at this link (but need not use anything from there, the following command lines are enough) https://launchpad.net/~mkusb/+archive/ubuntu/ppa
If you run standard Ubuntu live, you need an extra instruction to get the repository Universe. (Kubuntu, Lubuntu ... Xubuntu have the repository Universe activated automatically.)
sudo add-apt-repository universe # only for standard Ubuntu live
sudo add-apt-repository ppa:mkusb/ppa # and press Enter sudo apt update sudo apt install mkusb usb-pack-efi
You can download the quick start manual and check the md5sums at this link http://phillw.net/isos/linux-tools/mkusb/
You need not download mkusb, install it via PPA instead, but here you can get some older versions
View or download the quick start manual http://phillw.net/isos/linux-tools/mkusb/mkUSB-quick-start-manual.pdf
Alternate link to the quick start manual version 11 mkUSB-quick-start-manual-11.pdf
Alternate link to the quick start manual version 12 alias dus mkUSB-quick-start-manual-12.pdf
Check the md5sums http://phillw.net/isos/linux-tools/mkusb/md5sum.txt.asc
Upgrade mkusb
General comments about upgrading
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
Advanced usage
Using mkusb and mkusb-nox from the command line is described 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?
Versions
Separate versions for graphical mode and text mode
mkusb has separate versions for
GUI mode: mkusb-dus and mkusb-11
text mode: mkusb-nox, mkusb-bas and mkusb-min
This avoids some complicated logic and makes the code smaller. Maybe 90% of you will prefer the GUI version, but the text versions are good for servers and for users who do not want eye-candy. The improved recognition of systems and devices is back-ported from the versions 8 and 9 to mkusb-nox. See this pdf manual. (Alternate link).
mkusb-min is a very small shellscript (compared to the other versions of mkusb).
Desktop files
Starting with version 12, mkusb is a set of tools. You may prefer to start from a desktop file,
mkusb.desktop
guidus.desktop
mkusb select tool
If you prefer to use command lines in a text screen or terminal window, there is a small shellscript that helps you select one of these tools, mkusb-select, and a symbolic link, mkusb, that points to mkusb-select. You can also start those tools directly.
dus |
guidus, mkusb-dus, mkusb version 12, 'Do USB Stuff' |
mkusb-11 |
Classic interface, mkusb version 11 |
mkusb-nox |
original text mode version of mkusb |
mkusb-bas |
basic text mode for old/basic linux |
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.
mkusb-min if you want it simple
If you want it simple or do not want to install anything unknown, yet want to 'wrap a safety belt around dd', you can use mkusb-min. It is a small shellscript, that is easy to read and understand. It needs no installation, you can run the shellscript locally (in the current directory).
See a detailed description of the minimal tool at /min.
See a detailed description of the minimal tool with added capability to create persistent live drives at /minp.
mkusb-bas if no other version works
Please try mkusb-bas if no other version 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).
GUI details
Details about installation and other aspects of using mkusb via GUI are described at /gui
mkusb-min
mkusb-min is a minimal bash shellscript that wraps a safety belt around dd.
See details at /min - really small, 5.4 kiB, only cloning
mkusb-minp
mkusb-minp is a bash shellscript that is the size of 20kiB (still small compared to mainstream mkusb). It wraps a safety belt around dd and can also create persistent live drives from iso files of Ubuntu 19.10 and Debian 10 and newer versions.
See details at /minp - small, can make persistent live drives
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. |
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
mkusb version 7
See details at /v7
mkusb-nox
This text mode quick start manual describes the non-menu No X version. (Alternate link).
sudo add-apt-repository ppa:mkusb/ppa # and press Enter sudo apt update sudo apt install mkusb-nox
See details at /v7#mkusb_version_7.5_-_mkusb-nox
mkusb-bas
There are some commands in mkusb and mkusb-nox, 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.
This basic mode quick start manual describes the basic version mkusb-bas.
mkusb-bas can be downloaded from phillw.net
wget http://phillw.net/isos/linux-tools/mkusb/mkusb-bas
See details at /v7#mkusb_version_7.4.x_-_mkusb-bas
mkusb version 8-10
mkusb versions 8-10 are deprecated. Find details about improvements and added features at /v8 /v9 /v10
mkusb version 11
mkusb version 11 is divided in mkusb (FOSS) and usb-pack-efi (with compiled code)
Find details about improvements and new features at /v11
Details about installation and other aspects of using mkusb via GUI are described at /gui
zenity is still the graphical user interface. It works like before and looks almost the same. You are able to toggle live only or persistent live, when your input file is an ISO file. And when you have started along the persistent path, some warnings may pop up and finally you are prompted to select the percentage of the remaining drive space for persistence. The rest of the drive space is used for storage compatible with Windows.
mkusb version 12
New: mkusb version 12 uses dus and guidus, the new user interface |
The intention with dus and its graphical front end guidus is to make it easier to use and easier to maintain. See more details at this link.
Find details about improvements and new features at /12
Details about installation and other aspects of using mkusb via GUI are described at /gui
Installing or downloading
Install mkusb via the PPA as described above or as described below with more details for Ubuntu. You can also download the separate files from http://phillw.net/isos/linux-tools/mkusb.
See this link for an easy method to install the bleeding edge version of mkusb.
Install mkusb-nox and mkusb-bas according to this link for the stable PPA or according to this link for the unstable PPA
Use only operating systems that are supported, 'current versions'
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.
Notice that the standard Ubuntu LTS versions are supported for 5 years, while the LTS versions of the other flavours are supported for 3 years. The other (non-LTS) versions are only supported for 9 months.
See this link, http://www.ubuntu.com/info/release-end-of-life
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).
Detailed instructions for Ubuntu and Debian
Tips for end of life versions
In versions of Ubuntu, that have passed end of life, and where you can no longer install programs from the repositories, but 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, so it is a good idea to upgrade or create a new version before end of life.
Ubuntu 12.04 LTS
This contains an extra instruction to get the repository Universe, where pv and wmctrl are stored.
Please notice that the version 12.04 LTS passed end of life in April 2017 unless you have extended security maintenance for Ubuntu Advantage customers.
Ubuntu 14.04.1 LTS and newer versions
This method applies to newer versions too: 14.04.x, 15.10, 16.04 LTS, ...
This contains a simpler instruction to get the repository Universe, where pv and wmctrl are stored.
Ubuntu community flavours
Kubuntu, Lubuntu and Xubuntu have the repository Universe activated, so it need not be added in order to install pv and wmctrl.
Debian
This link contains an instruction to install the ppa 'manually'.
Other linux distros
In most linux distros, where 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). See the link /gui#from_phillw.net. 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.
Windows
Quick method to get a portable linux system
The intention with 9W-DUS_i686.exe is to provide a quick method to get a portable linux system with the tool dus (mkusb-dus), that 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.
Stop cluttering the 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
Documentation
The quick start manual and the opening post in this thread add to the information in this wiki page. Remember the links to the #Screendumps of the menus near the end of this page.
After installation from the PPA there is also a manual page
man mkusb
Feedback
Please give me feedback about this release candidate: help me find bugs and suggest improvements!
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
'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
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:
/text-screen-dumps/dus-22-guidus-console_making_windows-boot-drive.txt
ISO testing
mkusb is very convenient for ISO testing, when the new daily build is to be recloned. See /isotesting
Screendumps
These 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.
Pictures
The pictures are screen-dumps and illustrate how to use mkusb:
the pictures directly for a fast internet connection /pictures
links to individual pictures for a slow internet connection /pictlinks
slideshow of mkusb 10.1.1 in Ubuntu 14.04.2 /v10/mkusb-in-ubuntu_slideshow.pdf or this alternate link
pictures describing 'Simple persistence' /sp/screendumps
Text screen dumps
The text screen dumps look simpler, but may show the work-flow in a good way: /text-screen-dumps
Links
Artwork subwiki, 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 the following wiki page (and links from it)