hdiutil
command, create a
.dmg file
from the .iso
file. To run the hdiutil
command open a Terminal window,
which you can do by running Terminal, which is found in
/Applications/Utilities
on an OS X system.
Convert the .iso file to .dmg using the convert
option of
hdiutil
and the -format UDRW
parameter.
When you specify UDRW
, a
UDIF
read/write image is created.
E.g., hdiutil convert -format UDRW -o /path/outputfile
/path/ubuntu_input_file.iso
, where
path
is the directory path pointing to where you want to store
the output file in the first instance of its use and the location of the
input .iso file in the second instance of its use, outputfile
is the name you wish to give to the output file and
ubuntu_input_file.iso
is the actual name of the .iso file
you downloaded. The following is an example:
$ hdiutil convert -format UDRW -o ubuntu-11.10-desktop-i386 ../ubuntu-11.10-desk top-i386.iso Reading Master Boot Record (MBR : 0)… Reading Ubuntu 11.10 i386 (Apple_ISO : 1)... Reading (Windows_NTFS_Hidden : 2)... ............................................................................... Elapsed Time: 1m 46.674s Speed: 6.5Mbytes/sec Savings: 0.0% created: /Users/jdoe/Downloads/ubuntu/ubuntu-11.10-desktop-i386.dmg
The hdiutil
utility will put a
.dmg extension on the output
file automatically. You could use the output file with the Disk Utility
application to create a bootable CD as you can see from the file type.
$ file ubuntu-11.10-desktop-i386.dmg ubuntu-11.10-desktop-i386.dmg: ISO 9660 CD-ROM filesystem data 'Ubuntu 11.10 i38 6 ' (bootable)
However, in this case, I want to create a bootable USB flash drive, instead, so
I need to identify how the Mac OS X system identifies the USB drive. Before
plugging the USB drive into the system, I can use diskutil list
to get a list of the current devices on the system.
$ diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *250.1 GB disk0 1: EFI 209.7 MB disk0s1 2: Apple_HFS Macintosh HD 249.6 GB disk0s2 /dev/disk1 #: TYPE NAME SIZE IDENTIFIER 0: Apple_partition_scheme *103.6 MB disk1 1: Apple_partition_map 32.3 KB disk1s1 2: Apple_HFS Google Chrome 103.6 MB disk1s2
I then rerun the command after plugging the USB flash drive into the system.
$ diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *250.1 GB disk0 1: EFI 209.7 MB disk0s1 2: Apple_HFS Macintosh HD 249.6 GB disk0s2 /dev/disk1 #: TYPE NAME SIZE IDENTIFIER 0: Apple_partition_scheme *103.6 MB disk1 1: Apple_partition_map 32.3 KB disk1s1 2: Apple_HFS Google Chrome 103.6 MB disk1s2 /dev/disk3 #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *8.0 GB disk3 1: DOS_FAT_32 NO NAME 8.0 GB disk3s1
In this case, I can easily tell that the 8GB USB flash drive is designated as
/dev/disk3
by the system by looking at the SIZE
column in the output.
The next step is to unmount the new device by using diskutil
unmountDisk /dev/diskN
where N
is the disk number obtained
from the prior command, in this case 3
.
$ diskutil unmountDisk /dev/disk3 Unmount of all volumes on disk3 was successful
After that, you can use the dd
command to write the .dmg
file created earlier to the USB flash drive to make a bootable Ubuntu
Linux flash drive. Execute the dd
command via sudo
with the following parameters for the dd
command.
sudo dd if=/path/ubuntu.dmg of=/dev/diskN bs=1m
The ubuntu.dmg
file will be the name of the .dmg output file
created using the hdiutil
command earlier and path
is the directory path pointing to where it is located on the system. N
is the disk number you obtained earlier from the diskutil list
command. E.g.:
$ sudo dd if=ubuntu-11.10-desktop-i386.dmg of=/dev/disk3 bs=1m Password: 695+1 records in 695+1 records out 729067520 bytes transferred in 437.164770 secs (1667718 bytes/sec)
You will be prompted for your password (I am presuming you are running the command from an account with administrator level privileges). Be prepared to possibly wait a few minutes for the process of transferring the contents of the image file to the USB drive to complete.
Note: If you see the error dd: Invalid number '1m'
, you are
using GNU dd. Use the same command, but replace bs=1m
with
bs=1M
. If you see the error dd: /dev/diskN: Resource busy
, make sure the USB drive is not in use. You can use the
Disk Utility application found in /Applications/Utilities
to unmount the drive (don't eject it).
Once you receive the message that the information has been transferred, you can remove the USB drive and use it to boot whatever system you wish to use it with to boot into Ubuntu from the USB drive.
References:
Created: Thursday April 19, 2012