Create bootable USB stick from ISO in Mac OS X

原文

Create bootable USB stick from ISO in Mac OS X

Booting from a USB stick is nowadays more and more important. More and more PCs (and servers) are delivered by default without a CD/DVD drive. To install the OS of your choice, USB sticks provide you the easiest possibility. In fact, it can even work out cheaper than burning a CD or DVD that you just throw away once the version is outdated.

For most Linux distributions the ISO for burning a CD/DVD is available freely on the internet. In this post I’ll assume you have already downloaded the bootable ISO image for the OS of your choice, but how to get the ISO image onto the USB stick?

The ISO file you have downloaded contains an image of the entire media. It includes all the files necessary to boot your PC/server. This image format is sadly not directly usable to copy onto the USB stick. We first need to convert the image from an ISO to a UDRW (Read/Write Universal Disk Image Format) which we can copy to the USB stick.

Some of the steps to create a bootable USB stick could be done in the GUI as well, but as some of them can’t and you have to go to the shell anyway, I decided to do all of the steps in the shell.

Convert the ISO to UDRW format

Mac OS X provides all the tools needed to convert the ISO image to UDRW. The following command will convert the ISO image to the UDRW format.

hdiutil convert -format UDRW -o destination_file.img source_file.iso

You will notice that the destination_file.img from the command will create the file destination_file.img.dmg really. This is because the hdiutil program automatically adds the dmg file extension. This is not a problem as the file extension won’t affect the format of the image.

Prepare the USB stick

Check your USB stick and make a backup if there is any important data on it, as the next steps are going to delete everything on it.

To prepare the USb stick we are going to delete all the partitions on the stick and create an empty partition. To do this we need to know the device name of the USB stick. Open a terminal and execute the following command:

$ diskutil list

You will see a list of disks and partitions. The goal is to identify the USB stick in this output. Depending on your system configuration your output might look different from this one. This appears to show 3 physical discs but it does not. The /dev/disk1 is a virtual disk created because of the partition encryption (FileVault 2) I enabled in Mac OS X.

/dev/disk0

#:? ? ? ? ? ? ? ? ? ? ? TYPE NAME? ? ? ? ? ? ? ? ? ? SIZE? ? ? IDENTIFIER

0:? ? ? GUID_partition_scheme? ? ? ? ? ? ? ? ? ? ? ? *500.1 GB? disk0

1:? ? ? ? ? ? ? ? ? ? ? ? EFI? ? ? ? ? ? ? ? ? ? ? ? 209.7 MB? disk0s1

2:? ? ? ? ? Apple_CoreStorage? ? ? ? ? ? ? ? ? ? ? ? 399.5 GB? disk0s2

3:? ? ? ? ? ? ? ? Apple_Boot Recovery HD? ? ? ? ? ? 650.0 MB? disk0s3

5:? ? ? ? ? ? ? ? Apple_Boot Boot OS X? ? ? ? ? ? ? 134.2 MB? disk0s5

/dev/disk1

#:? ? ? ? ? ? ? ? ? ? ? TYPE NAME? ? ? ? ? ? ? ? ? ? SIZE? ? ? IDENTIFIER

0:? ? ? ? ? ? ? ? ? Apple_HFS MacOSX? ? ? ? ? ? ? ? *399.2 GB? disk1

/dev/disk2

#:? ? ? ? ? ? ? ? ? ? ? TYPE NAME? ? ? ? ? ? ? ? ? ? SIZE? ? ? IDENTIFIER

0:? ? ? GUID_partition_scheme? ? ? ? ? ? ? ? ? ? ? ? *2.0 GB? ? disk2

1:? ? ? Microsoft Basic Data UNTITLED 1? ? ? ? ? ? ? 2.0 GB? ? disk2s1

As shown in the output above, the connected USB stick is a small 2.0 GB drive with a FAT partition on it. We are now going to remove this partition in the next step. For the following steps we will need the name of the disk which in this case is “/dev/disk2”.

With the following command the data on the disk (your USB stick) will be deleted!

$ diskutil partitionDisk /dev/disk2 1 "Free Space" "unused" "100%"

With this command the USB stick was re-partitioned to have 1 partition without formatting and 100% of the size of the stick. If you check it again with “diskutil list” you will see the changes already, also the USB stick will no longer be shown in the Finder.

Copy the image to the USB stick

Now we can copy the disk image we created to the USB stick. This is done via thedd(1)command. This command will copy the image to the disk (substitute the appropriate disk name for your USB stick here, as with the re-partitioning command):

$ dd if=destination_file.img.dmg of=/dev/disk2 bs=1m

The dd command does not show any output before it has finished the copy process, so be patient and wait for it to complete.

$ diskutil eject /dev/disk2

To eject the USB stick, use the above command. After this is done, the bootable USB stick is ready to be used.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市制恍,隨后出現(xiàn)的幾起案子神凑,更是在濱河造成了極大的恐慌何吝,老刑警劉巖鹃唯,帶你破解...
    沈念sama閱讀 218,755評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異黔酥,居然都是意外死亡洪橘,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,305評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門坑夯,熙熙樓的掌柜王于貴愁眉苦臉地迎上來岖寞,“玉大人,你說我怎么就攤上這事指巡。” “怎么了藻雪?”我有些...
    開封第一講書人閱讀 165,138評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵勉耀,是天一觀的道長。 經(jīng)常有香客問我便斥,道長,這世上最難降的妖魔是什么枢纠? 我笑而不...
    開封第一講書人閱讀 58,791評(píng)論 1 295
  • 正文 為了忘掉前任晋渺,我火速辦了婚禮,結(jié)果婚禮上木西,老公的妹妹穿的比我還像新娘。我一直安慰自己八千,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,794評(píng)論 6 392
  • 文/花漫 我一把揭開白布关翎。 她就那樣靜靜地躺著鸠信,像睡著了一般。 火紅的嫁衣襯著肌膚如雪星立。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,631評(píng)論 1 305
  • 那天绰垂,我揣著相機(jī)與錄音,去河邊找鬼劲装。 笑死,一個(gè)胖子當(dāng)著我的面吹牛绒怨,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播南蹂,決...
    沈念sama閱讀 40,362評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢(mèng)啊……” “哼六剥!你這毒婦竟也來了峰伙?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,264評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤秃嗜,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后顿膨,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,724評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡必搞,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,900評(píng)論 3 336
  • 正文 我和宋清朗相戀三年囊咏,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了塔橡。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片霜第。...
    茶點(diǎn)故事閱讀 40,040評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖泌类,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情刃榨,我是刑警寧澤,帶...
    沈念sama閱讀 35,742評(píng)論 5 346
  • 正文 年R本政府宣布桌吃,位于F島的核電站苞轿,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏呕屎。R本人自食惡果不足惜敬察,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,364評(píng)論 3 330
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望莲祸。 院中可真熱鬧,春花似錦锐帜、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,944評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽述暂。三九已至,卻和暖如春建炫,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背肛跌。 一陣腳步聲響...
    開封第一講書人閱讀 33,060評(píng)論 1 270
  • 我被黑心中介騙來泰國打工察郁, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留皮钠,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,247評(píng)論 3 371
  • 正文 我出身青樓鳞芙,卻偏偏與公主長得像,于是被迫代替她去往敵國和親原朝。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,979評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容