Thursday, December 29, 2011

Creating a bootable USB key under Apple Mac OSX

I wanted to install a new (to me) Linux distribution - CentOS - onto my Thinkpad W500, and was looking to avoid finding and using a CD-ROM or DVD.

Having a spare USB thumb-drive kicking about, I was hoping that I could use that instead, and also "burn" the image from my Mac.

I'd already downloaded the CentOS ISO to my Mac Downloads folder, and had previously mounted it.

A quick Google search found me this MacRumours forum thread - how to "burn" an ISO to USB flash drive? - which provided a variety of answers, some positive, some not-so-positive.

Having said that, I scrolled to the very end of the thread, and found this post - Final Solution - from someone called Candlejack, which had the answer.

Basically, it's a bunch of Terminal commands :-) 

$ diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Hard Disk               319.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *8.3 GB     disk1
   1:                 DOS_FAT_32 DISK_IMG                8.3 GB     disk1s1
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            CentOS-6.2-x86_6       *731.9 MB   disk2

$  diskutil unmountDisk /dev/disk1

Unmount of all volumes on disk1 was successful

$  dd if=/dev/disk2 of=/dev/disk1 bs=1m

dd: /dev/disk2: Resource busy

$  diskutil unmountDisk /dev/disk2

Unmount of all volumes on disk2 was successful

$ dd if=/dev/disk2 of=/dev/disk1 bs=1m

698+0 records in
698+0 records out
731906048 bytes transferred in 206.409147 secs (3545899 bytes/sec)

Job done.

I was then able to boot the Thinkpad from the USB drive ( via the [F12] function key ) and install CentOS, far far quicker than I could've installed from a CD or DVD.

PS For the record, I've previously blogged about CentOS, with regard to installing IBM HTTP Server on it here.

No comments:

Post a Comment