Thursday, 4 May 2017

Create a bootable USB from a Mac

 I explained the process to obtain a bootable USB from an Linux (or other) on Mac. The UNetbootin software fails to create a USB that boots correctly with an UEFI environment.

 Lately, when I tried to reinstallation on one of my laptops, I got a nice message Operating System Not Found

The Mac is already equipped with everything needed to do this command line operation. Let's not wait any longer and let's go!
First of all,  you can imagine that you have the ISO of your preferred distribution. Then, you need to convert this ISO to the Apple UDRW image format. To do this, hdutilsettle the matter in a single spoon.

# We first place ourselves in the directory where our image is

Cd ~ / Desktop~ / Desktop

# Convert the linx.iso image to linx.img (will actually create a linx.img.dmg image)# On converting the linux.iso image to linux.img (will actually create a linx.img.dmg image)
Hdiutil convert -format UDRW -o linx.img linx.iso- UDRW format - o linx . Img linux . iso
We then insert our usb key and determine its address.
# First step, we locate the usb disk
Diskutil list
/ Dev / disk2 (external, physical):/ Dev / disk2 ( external , physical ):
   0: GUID_partition_scheme * 8.0 GB disk20 :       GUID_partition_scheme                         * 8.0 GB disk2
   1: EFI EFI 209.7 MB disk2s11 :                         EFI EFI                      209.7 MB disk2s1
   2: Microsoft Basic Data 8GB 7.8 GB disk2s22 : Microsoft Basic Data 8GB 7.8 GB disk2s2                               
You must list the different volumes with the command diskutil, your usb key is an external volume. Tip, unplug other external media so you do not get it wrong. Also, make sure that the size matches your key before formatting ...
We will delete all the available space on the key. It's not absolutely necessary as a step, but I find it cleaner to erase all the contents of the key before copying our iso. Since it takes only 3 seconds 30, we do not deprive ourselves.
# On formate / dev / disk2 as blank space
Diskutil partitionDisk / dev / disk3 1 "Free Space" "unused" "100%"/ Dev / disk2 1 "Free Space" "unused" "100%"   

# Then the most important step, and the longest, the copy of the iso on the key# Then the most important step, and the longest, the copy of the iso on the key
Sudo dd if = linx.img.dmg of = / dev / disk2 bs = 1mIf = linx . Img . Dmg of = / dev / disk2 bs = 1m

When this command returns, your usb bootable is ready!

No comments:

Post a Comment