Creating a bootable USB stick from OSX

I was having some trouble getting my ML110 Proliant lab server to boot from a USB drive that I had created with UnetBootin on my Mac. Initially, I thought it was a problem with the ML110 server, but it turns out that Unetbootin does not currently make a fully bootable USB stick in OSX. The trick is that you have to set up the master boot record correctly yourself using DiskUtil, fdisk and an MBR file from the SysLinux project. In this tutorial I will show you how.

If you would like to create a bootable USB drive from OSX, you will need:

Step 1 – Format the disk in Disk Utility, with the correct MBR

Assuming you have already inserted your USB drive into your Mac…

a) Open Disk Utilty

b) Select the USB device

c) Click Partition

d) Select 1 partition in the partition layout

e) Select “Master Boot Record” in the options

f) Select MS-DOS (FAT) in the format type.

g) Click Apply, then Partition

h) Close Disk Utility

This will wipe the USB disk and set it up with the correct boot record.

Step 2  – Install the MBR binary from the SysLinux project

Open up a terminal and then

a) Use the command line diskutil to find the device name for your USB drive.

diskutil list

a) Umount the USB drive with the command line. NB: Be sure to swap the device reference (in my case it is /dev/SOMEdisk2) with the correct one for your usb key that you identified in the previous step – this will change for each machine.

diskutil unmountDisk /dev/SOMEdisk2

b) Mark the partition active, then unmount it again

sudo fdisk -e /dev/SOMEdisk2
print
f 1
write
print
exit
diskutil unmountDisk /dev/SOMEdisk2

c) Download Syslinux

mkdir -p ~/Documents/BootableUSB
cd ~/Documents/BootableUSB
curl -L -O http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-5.00.zip
unzip syslinux-5.00.zip -d syslinux-5.00
cd syslinux-5.00/mbr

d) Install the MBR – NB: Update the device name (/dev/SOMEdisk2) to the one you identified in the first step!!!

sudo dd conv=notrunc bs=440 count=1 if=mbr.bin of=/dev/SOMEdisk2

Step 3 – Use UnetBootin to install your OS install files

a) Download and install UnetBootin if you haven’t already from http://unetbootin.sourceforge.net

b) Load the application, choose your preferred distribution, and then click OK.

c) When it’s finished, eject the usb key and use it!

References

Thanks to a tip I found on http://perpetual-notion.blogspot.co.uk/2011/08/unetbootin-on-mac-os-x.html

20 thoughts on “Creating a bootable USB stick from OSX”

  1. Just FYI, there’s a copy of mbr.bin inside of UNetbootin.app, so you don’t need to bother with installing syslinux in full:

    unetbootin.app/Contents/Resources/mbr.bin

  2. There is no longer a mbr/mbr.bin, but there are mbr.bin files in other places:

    /tmp/syslinux-6.02/bios/mbr/mbr.bin
    /tmp/syslinux-6.02/efi32/mbr/mbr.bin
    /tmp/syslinux-6.02/efi64/mbr/mbr.bin

    Since I don’t have an efi boot, I chose the first one, but for some reason, it is not getting recognized as bootable. I also used the mbr.bin from the unetbootin installation itself, as suggested by Kyle and that too didn’t help. I have another flash drive that I created on windows (long ago) using HP format utility and unetbootin, and that works perfectly on this system. Since the old drive and the new one are exactly of the same size, I tried cloning it using dd and the new one boots fine, so not sure what is going wrong with a fresh install.

    The reason I want to do a fresh install is because the old one, though boots, gives me errors during the boot, so I am suspecting that the drive is failing. What could be going wrong with the above steps that I am following as is?

  3. When I’m entering “sudo fdisk -e /dev/SOMEdisk2” I get the error: “fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory”

    I’m a bit new at this. Thoughts?

  4. Thanks man! I really appreciate it, this guide was quite a bit more thorough then others I found. Kudos!

  5. I followed this guide, trying to make a bootable usb drive for Windows 8.1 on my macbook. I was able to boot into the drive but i’m prompted with a window that says to choose the unet boot and the only option is “default”.

    There’s a 10second timer saying it’s going to Auto Boot. selecting default or letting it auto-boot just loop back to this screen.

    What am i doing wrong?

  6. I tried doing this as a way to install windows on my new desktop pc that does not have a dvd drive.

    I spent about three hours trying to troubleshoot what happened at this point:
    diskutil unmountDisk /dev/SOMEdisk2

    kept getting
    disk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory

    If you can install a copy of windows on a bootcamp partition, you can create a windows install disk with the iso image of said install disk on windows, and thusly with the correct bios. then erase that partition and begin installation on the new computer.

  7. Daniel, I had the same issue. What I found is, rename the ISOLINUX.CFG to SYSLINUX.CFG, edit the file (NOT WORD or NOTEPAD or anything that will add stupid linebreak characters). Modify the contents, so the line “APPEND -c boot.cfg” looks like this: “APPEND -c boot.cfg -p 1” without the quotes. Unmount and eject the disk, and viola; I got the menu option for ESX install.

  8. Andre, I also have the same problem but cannot even locate the named file because it’s already named syslinux with different contents when opened in a text editor. How did you find the correct file to modify?

  9. It’s been some years now since these instructions were written, and I’m wondering: are they still accurate?
    ’cause when I get to…

    mkdir -p ~/Documents/BootableUSB
    cd ~/Documents/BootableUSB
    curl -L -O http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-5.00.zip

    I get a message telling me…

    -bash: https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-5.00.zip/: No such file or directory

    I tried newer versions instead of the 5.00, I tried https instead of http, but the same message just keeps coming.
    Or perhaps it’s normal and it’s jut my lack of understanding for linux.
    Any sort of help on this would be greatly appreciated.

  10. For those of you that got “could not open MBR file /usr/standalone/i386/boot0: No such file or directory” — just ignore it.

  11. Everything worked, just follow Hari’s tip about the mbr.bin file that is located inside the bios folder of syslinux.

  12. How do I make the partition active and inactive when installing Syslinux? Missing steps!

  13. This worked perfectly for me. I was having trouble creating bootable USBs on my Mac OS with Unebootin. Executing this actually created a bootable USB on my R710. I did not have access to a windows PC.

    The only modifications I did was I created a different directory not in documents as it seems documents is a weird folder now that there is cloud syncing in OS.

    mkdir -p ~/Server/BootableUSB
    cd ~/Server/BootableUSB

    Everything else worked perfectly. I ignored the error fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory

  14. I did this and all seemed to work, until I put the USB in my PC with a blank new HDD. Same issue add Daniel above.

  15. MAny Thanks for providing this tutorial to prepare bootable USB. It worked like a charm.

Leave a Reply

Your email address will not be published. Required fields are marked *