mkusb logo   mkusb   mkusb logo

Contents

  1. mkusb
    1. a tool for creating bootable USB drives
    2. Tutorials
    3. Quick Start
      1. Repository Universe for Ubuntu Desktop Live
      2. mkusb PPA
      3. Install mkusb packages
      4. mkUSB-quick-start-manual
    4. Fix to make persistent live drives for Ubuntu 23.04 Desktop
    5. WARNING: mkusb will overwrite the entire target device
  2. Advanced usage
    1. When to use (and not use) isohybrid
    2. Upgrade mkusb
    3. Command line syntax
    4. Autoclone
    5. Software Features
      1. mkusb-dus: For Graphical Environments
      2. mkusb-nox: For Servers and Shell Environments
      3. mkusb-min: The smallest safety belt over dd
      4. mkusb-bas: When Nothing Else Works
      5. Additional Feature: mkusb-plug
      6. Additional Feature: mkusb-xscl
    6. Is Thunar cluttering your Desktop?
  3. Installation
    1. mkusb releases
      1. Older Releases
      2. Newer Releases
      3. If you use mkusb, help test it!
    2. Ubuntu
    3. Debian
    4. Other linux distros
    5. Windows Installation
      1. Quick method to get a portable linux system
      2. Win32 Disk Imager
  4. Description of the method and the tool
    1. Warning about overwriting the target device
    2. Help selecting the correct target device
    3. Doing the same thing many times
    4. The standard tools
    5. dd image of iso file to USB device safely
      1. iso-testing mode
    6. Shell script
    7. Persistent live systems
      1. 'mkusb/persistent' system in one single drive
      2. 'Simple persistence' in two drives
    8. Expansion and imaging from a compressed image file
      1. Check the download with md5sum
    9. Re-use the pendrive
    10. Wipe the first megabyte or the whole device
      1. Wipe the whole device
    11. Windows USB install drive
      1. Reliable to extract via a tarfile
      2. Problem with the 4 GiB max file size in FAT32
      3. New method works with current versions of Windows
      4. mkusb-nox
      5. dus with guidus alias mkusb version 12
  5. References

mkusb

a tool for creating bootable USB 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

Repository Universe for Ubuntu Desktop Live

1. Enable the Universe pocket of the Ubuntu Repositories in Ubuntu Desktop Live (if booted from a LiveCD/LiveUSB). Most if not all live versions of the Ubuntu community flavors (Kubuntu, Lubuntu ... Xubuntu) already have this enabled. Running this command won't cause any harm to those flavors.

sudo add-apt-repository universe

In Ubuntu Desktop 22.04.1 LTS Live (and probably also future live versions) the output from 'sudo apt update' will contain some warnings unless you 'clean' the cdrom line of 'sources.list'. (Running this command is not necessary, but will make updating via the command line look better.)

sudo -i sed '/deb cdrom:/s/ universe//' /etc/apt/sources.list

mkusb PPA

2. Add the mkusb PPA

If you want the stable version:

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

or if you want the bleeding edge version:

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

Install mkusb packages

3. Install the mkusb packages from the PPA, the standard way for example into Ubuntu Desktop and other systems with a graphic environment,

  • sudo apt install mkusb

The following command is an alternative for systems without a graphic environment for example Ubuntu Server,

  • sudo apt install dus mkusb-nox

The following command is OPTIONAL for installed systems.

DO NOT use if booted from a LiveCD/LiveUSB.

  • sudo apt full-upgrade

The following command is OPTIONAL - to make persistent live drives

  • sudo apt install usb-pack-efi

mkUSB-quick-start-manual

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

  • mkusb-quick-start-manual-22.png

Fix to make persistent live drives for Ubuntu 23.04 Desktop

mkusb-dus had problems to make persistent live drives from the standard Ubuntu 23.04 'Lunar' Desktop iso file. The reason is that the 'linux line in grub' that is the 'cmdline' is modified compared to the previous versions. This Lunar version has a new installer and the boot structure was also modified. The shellscripts dus-persistent and dus-iso2usb are improved (the bugs are fixed), so mkusb-dus works correctly now in version 23.1.1, uploaded 2023-04-21 into the unstable PPA.

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

start-mkusb-from-act-or-dash_800x599.png

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

'dus' manages a set of shellscripts for tasks indicated by the names:

  • dus-live
  • dus-iso2usb
  • dus-persistent
  • dus-restore
  • dus-wipe
  • dus-home-backup
  • dus-home-restore

dus-iso2usb is new. It was introduced when the mkusb version was upgraded to 22. The main purpose is to make a USB boot drive that 'just works' particularly in computers (new or old), that are difficult to boot. 'dus-iso2usb' can create both live (live-only) and persistent live drives from Ubuntu and Ubuntu community flavours. You cannot expect it to work with other Linux distros.

1. The standard method for a live drive is cloning with the tool 'dus-live', but when necessary, select 'dus-iso2usb'.

2. The standard tool for a persistent live drive is dus-persistent which is well debugged and tweaked to work is most cases, but when there are problems, select 'dus-iso2usb'.

There are more details at /dus-iso2usb.

mkusb-nox: For Servers and Shell Environments

Users without a GUI may prefer 'mkusb-nox'. It can clone an iso file or img file to make a live drive in a safe way. It has the original mkusb user interface to help you identify and select the correct target device. 'mkusb-nox' works with USB and other drives seen as '/dev/sdx' and memory cards seen as '/dev/mmcblkn' where 'x' is a letter and 'n' is a digit.

mkusb-nox can still be very efficient for iso-testing (repeated cloning of daily updates of iso files to the same target device even when running in a terminal window of a graphical desktop environment).

sudo mkusb-nox file.iso all   # 'all' to show all mass storage devices

mkusb-nox_same-iso_w-lsblk.jpg

You find a detailed description in the NOX Quick Start Manual and at /v7.

Please notice that 'mkusb-dus' works also in text mode and will replace 'mkusb-nox' for many users.

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

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

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

New: mkusb version 22 introduces dus-iso2usb

The main function of dus-iso2usb is to

  • extract the first partitions and the grub structure from compressed image files
  • create new partitions, one for an iso file labeled 'isodevice', and one optional for persistence labeled 'writable' (or in older systems labeled 'casper-rw').
  • copy iso file to 'isodevice' and add some tweaks.

This makes a system that can boot via grub into an iso file both in UEFI mode and BIOS mode (alias CSM alias legacy mode), 'grub-n-iso'.

Older Releases

mkusb versions 7-11 are deprecated. Find details about improvements and added features at

Newer Releases

mkusb-dus 'was' version 12 until May 2022, when it was 'renumbered' to match the current year: version 22. Find details about improvements and added features at /12 /22 /gui /artwork/mkusb24.png

mkusb-plug: /plug

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 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 2023-05-05 11:41:40 by nio-wiklund)