/artwork/mkusb128.png

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.

If you run standard Ubuntu, 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

sudo add-apt-repository ppa:mkusb/ppa  # and press Enter
sudo apt-get update
sudo apt-get install mkusb mkusb-nox usb-pack-efi

You find the PPA at this link (but need not use anything from there, the previous command lines are enough) https://launchpad.net/~mkusb/+archive/ubuntu/ppa

You can download the quick start manual and check the md5sums at this link http://phillw.net/isos/linux-tools/mkusb/

Upgrade mkusb

Remove the old version before installing mkusb version 11.1.7

Because of a new structure of the mkusb PPA with 'common packages', you may need to remove the old mkusb package before it will work correctly to install new versions, to 'upgrade' mkusb. This is only a temporary problem until the new structure of mkusb 11.1.7 is installed (you need do it only once).

We assume that you have the PPA repository already. Then the following command should do what you want,

sudo apt-get remove mkusb  # remove the old version of mkusb with its set of files and directories

sudo apt-get update
sudo apt-get install mkusb mkusb-nox usb-pack-efi

If you installed from PPA - run mkusb from the menu or dash

If you have installed mkusb from the PPA, you can run it from the menu or dash (or link mkusb.desktop to your desktop).

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

Advanced usage

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

Versions

Separate versions for graphical mode and text mode

mkusb has separate versions for

  • GUI mode: mkusb /artwork/mkusb24.png

  • text mode: mkusb-nox and mkusb-bas

This avoids some complicated logic and makes the code smaller. Maybe 90% of you will prefer the GUI version, but the text version is 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.

Please try either or both of mkusb and mkusb-nox or if none of them works, try 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. See this pdf manual.

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

mkusb version 7

See details at /v7

mkusb-nox

This text mode quick start manual describes the non-menu No X version 7.5

sudo add-apt-repository ppa:mkusb/ppa  # and press Enter
sudo apt-get update
sudo apt-get 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 /artwork/mkusb24.png

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 /artwork/mkusb24.png

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 /artwork/mkusb24.png

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

Detailed instructions for Ubuntu and Debian

Ubuntu 12.04 LTS

This contains an extra instruction to get the repository Universe, where pv and wmctrl are stored.

/install-to-ubuntu-12.04

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.

/install-to-ubuntu-14.04.1

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'.

/install-to-debian

Other linux distros

Downloading and using mkusb-installer works with several linux distros. Use 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.

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

I have been happy using unetbootin, because of its high success rate. I also tested Ubuntu's startup disk creator usb-creator-gtk, which has the advantage that you reach Ubuntu's first screen, that is skipped by unetbootin. Both tools work with my computers and can be used to create persistent live systems. See this link for more details https://help.ubuntu.com/community/Installation/FromUSBStick

Tools like the Startup Disk Creator 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).

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.

I cloned ubuntu-13.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).

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-01-persistence-selected-medium.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

Wipe menu

There is a wipe menu, where you can select several options, either only wiping or wiping plus creating a partition table and some partition(s) and file system(s).

/wipe#Wipe_menu

/pictures/wipe-menu-01_starter-menu_select-wipe-menu.png

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:

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)

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

mkusb (last edited 2016-12-31 17:33:57 by ister-kokos)