Creating a bootable USB from an ISO image in OSX (High Sierra)
Once upon a time I was a .NET developer, and a lot of my development work took place in a Windows environment. I owned a machine that ran Windows and Visual Studio at a blistering rate, and everything in the kingdom was happy until one day I became more interested in open source development, bought a Macbook Pro and banished my trusty old workhorse to the shadows of the spare bedroom.
It's a sad thing to see a faithful and once glorious machine just rusting away like that, and as it was still very useable for pretty much everything other than modern gaming, I decided to breath life back into it with a copy of Linux.
My NVIDIA card seemed to hate everything but Linux Mint (even Ubuntu, which seems a bit weird since it's the foundation of Mint), and it took me quite a lot of experimentation and installation time before I finally settled on a Linux flavour that suited my needs.
The steps that I describe in this article aren't new at all, but there were a few gotches that I didn't see mentioned in the other articles that I read, so I've written about them here.
By the end of this article, you should be able to:
- Create a bootable USB stick using an ISO image
- Boot a machine from the USB stick *
- OSX (High Sierra)
- an ISO image that can be used to boot a compatible machine (so most likely an operating system of some sort)
- a USB stick that is formatted so that is big enough to hold your ISO image
Make sure that OSX can read your USB stick
If you can browse the contents of your USB stick in Finder then you're all good to go, and you can skip ahead to the next section. Otherwise, you'll need to format your stick:
Convert your ISO to UDRW
If OSX can read your USB stick then you're all set to proceed.
In order to write the ISO file to a USB stick in such a way that it will become bootable, we must first convert it to a format that is mountable in OSX.
UDRW is a UDIF (Universal Disk Image Format) read/write image that can be mounted on OSX, and we can use the built-in hdiutil to perform this conversion.
hdiutil convert -format UDRW -o nameYourOutputFile nameOfYourInputFileISO
Prepare your USB stick
/dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *251.0 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_APFS Container disk1 250.8 GB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +250.8 GB disk1 Physical Store disk0s2 1: APFS Volume Macintosh HD 158.0 GB disk1s1 2: APFS Volume Preboot 20.4 MB disk1s2 3: APFS Volume Recovery 509.8 MB disk1s3 4: APFS Volume VM 3.2 GB disk1s4 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *8.0 GB disk2 1: Apple_HFS Untitled 8.0 GB disk2s1
diskutil partitionDisk /dev/disk2 1 "Free Space" "unused" "100%"
Started partitioning on disk2 Unmounting disk Creating the partition map Waiting for partitions to activate Finished partitioning on disk2 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *8.0 GB disk2 1: EFI EFI 209.7 MB disk2s1
dd if=pathToYourOutputFile.dmg of=/dev/disk2 bs=1m
A few gotchas
Using your image to boot a machine
This is where things get very fuzzy, because it all depends on the type of motherboard you're using. I'll describe the steps I took to boot my old desktop from a USB stick containing Linux Mint, but you'll need to adapt this for your specific situation.
Hopefully the machine will now boot from your USB stick, and you can use it in the way you were planning.
So that's pretty much all for this month's exciting episode. You should now have a USB stick that you can use to boot a compatible machine.
It's a bit of a bummer that you'll need to wing the BIOS setup to a certain extent, but hopefully I've given you something of a head start in that direction.
Now that you're done.......
If you like indie / punk rock, have a listen to this onBandcamp(orYouTube):
If you liked that article, then why not try:
Passing environment variables into a Dockerised NGINX configuration
I was recently working on a small project that required environment variables to be passed into an NGINX Docker container from the host system. I quickly discovered that NGINX configs don't handle this in quite the way that I expected, so I decided to document the solution that I eventually came up with.