Video icon 64
Learn to code with practical video courses from Tuts+. Start your free trial today.
Advertisement

How to Create a Bootable Ubuntu USB Drive, for PC, on a Mac

by

Ubuntu, a Nguni Bantu term meaning Human-ness, recently released version 14.04 LTS (Long Term Support) codename Trusty Tahr.  Based on Debian Linux, Ubuntu is estimated to be used on more than 26% of all Linux websites.  

Since its first release in October 2004, it is estimated that, in 2011, Ubuntu had in excess of 20-million users worldwide and it is being increasingly adopted for large-scale public sector deployments, notably the Gendarmerie Nationale, thus replacing expensive Microsoft Office licences with OpenOffice for 5,000 workstations.

Regardless of whether you have thousands of workstations, or not, experimenting with Ubuntu from a USB drive is a good way to get an introduction to this interesting and alternative operating system.

In this tutorial I'll show you how to use Mac to create a Ubuntu USB drive that can be used on a PC.

How to Create a Bootable Ubuntu USB Drive

1. Download Ubuntu

Downloading Ubuntu

Open a web browser and navigate to the Ubuntu download page.

In the dropdown menu, under Choose your flavour, ensure that you select the appropriate version.  In my example, I want to create a USB drive for fairly low-specced Windows PCs, so I have selected 32-bit (for machines with less than 2GB RAM) then click the Download button.

At the time of writing, the current version of Ubuntu is 14.04 LTS which was released in April 2014. The LTS denotes that this version is a Long Term Support version, in other words this version an LTS version includes updates for new hardware, security patches and updates to the Ubuntu stack for a period of five years following the version release. 

2. Convert the Downloaded File Format

It is first necessary to convert the downloaded .iso file to a .img.  This is done with the hdiutil command in Terminal.

Using the hdiutil command to convert .iso to .dmg

Open Terminal and enter the following command:

hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso

Replace the /path/to/ with the actual path to the files in question, for example:

hdiutil convert -format UDRW -o ~/Downloads/ubuntu-14.04-desktop-i386 ~/Downloads/ubuntu-14.04-desktop-i386.iso

Tip: OS X may append the file extension .dmg to the output file, so you'll end up with  ubuntu-14.04-desktop-i386.img.dmg To avoid this, remove the .img from the filename when you enter the information into Terminal.

Confirmation of completion of the hdiutil command

3. Determine the Device Node for the USB Drive

Identify the attached devices with the diskutil list command

Enter the following command, in Terminal, to determine the connected devices:

diskutil list

Make a note of the output information.  Then insert the USB drive and run the command again.  Look for the difference and check that the capacity of the new drive matches the USB drive that you have inserted.

Determining the USB drive using the diskutil list command

Once you have made a note of the identity of the USB drive, in my case /dev/disk2, execute the following command:

diskutil unmountDisk /dev/diskN 

Where N denotes the node number assigned to the USB drive.  In my example, I run the command:

diskutil unmountDisk /dev/disk2
Unmounting the USB drive (don’t eject it!)

4. Create the Bootable USB Drive

To create the USB drive, the command dd is used to copy and convert a file.  This is a very powerful command and it should be used with care and caution.  

If used incorrectly it is possible to corrupt the the hard drive of a Mac with catastrophic consequences meaning that you will not be able to boot into OS X.  Double-check and triple-check that you have entered the command correctly.

Be extremely careful when using the sudo dd command

Enter the following command into the command line:

sudo dd if=/path/to/ubuntu-14.04-desktop-i386.dmg of=/dev/rdiskN bs=1m

In my case, this is:

sudo dd if=/Users/johnnywinter/Downloads/ubuntu-14.04-desktop-i386.img.dmg of=/dev/rdisk2 bs=1m

An explanation of the command used is:

  • sudo means substitute user do and gives you greater privileges to carry out a command that you would normally not be able to execute.
  • dd means convert and copy
  • if is the input file
  • of is the output file

It will be necessary to enter the Mac's admin user password in order to proceed with this command, so enter the password at the Password: prompt in Terminal.  

Note, when you enter the password, you will not see the characters or any asterisks as you might expect.  Though the cursor does not move, Terminal is accepting the characters that are being entered.

Once the password has been entered, press the Enter key.

It is also important to note that there is no indication or display of progress whilst Terminal executes the command entered.  Sit tight, it will take a few minutes to complete.  Don't be tempted to interrupt the process in any way; be patient and wait for the confirmation from Terminal that the process has completed.

5. Prepare to Remove the USB Drive

It may be that, on completion of the creation of the USB drive, a dialogue box pops up that says The disk you inserted was not readable by this computer.  

Don't worry about this warning and don't click on any of the buttons just yet

There are three buttons: Initialize...Ignore and Eject. Don't click any of them!

Confirmation of the completion of the sudo dd command

Instead, return to Terminal where you should see a confirmation that the process has completed. In my example, the confirmation reads:

970+0 records in
970+0 records out
1017118720 bytes transferred in 196.625902 secs (5172862 bytes/sec)
Ejecting the USB drive from Terminal.  Don’t eject it any other way.

At the command prompt, enter the command:

diskutil eject /dev/diskN

Where N is the node number assigned to the USB drive. In my case it is disk2, so the command entered is:

diskutil eject /dev/disk2

Regarding the dialogue box, click Ignore to get rid of it.

It is now safe to remove the USB drive from the Mac.

Test the Ubuntu USB Drive

The newly created Ubuntu USB drive is now ready to be inserted into a PC as a live-drive from which you can run the Ubuntu operating system.

The USB drive can also be used to install Ubuntu, alongside or in place of, Windows on a PC.

Advertisement