7

I want to put 2 partitions on my USB stick: first one (so Windows can see it) with FAT32 (so also macOS can write to it) and a second one, bootable with system-rescue-cd on it.

I started looking how to partition the stick and I discovered that Disk Utility will not let me create partitions on the USB stick (the button is disabled), let alone configure the partition as bootable in the MBR.

There is plenty of ways to do that on GNU/Linux, other also works on Windows but I didn't find anything for macOS. Is there any free (as a beer) way to do that?

1 Answer 1

9

You need to use diskutil through Terminal to accomplish this.

The command you would use is

diskutil partitionDisk diskX 2 MBR fat32 "LINUX" 80% fat32 "RESCUE" 20%

A few notes:

  • diskX is the identifier of your USB stick (use diskutil list to get that info)
  • For this example, I am using a 1GB flash and dedicating 80% of it to the Linux partition and 20% to the Rescue. You can use actual size values like 800MB and 200MB rather than percentages.
  • You will need a boot loader (like GRUB2) installed. If your rescue CD already has one, just dd the image to the "Rescue" partition.
  • "Linux" and "Rescue" are the names of the partitions
  • The partitions will be created in the order listed.

Per the man page:

partitionDisk device [numberOfPartitions] [APM[Format] | MBR[Format] | GPT[Format]] [part1Format
                part1Name part1Size part2Format part2Name part2Size part3Format part3Name part3Size ...]
6
  • Yeah from command line it does actually work, and using unetbootin I manage to install syslinux + my iso image.
    – zambotn
    Aug 3, 2017 at 2:53
  • 1
    BTW I still don't get why DiskUtility.app doesn't allows me to partition the USB key from the GUI, is it normal? I come from GNU/Linux and I've been told that in macOS is user-friendly so you don't need to use the console.
    – zambotn
    Aug 3, 2017 at 3:00
  • 2
    I forgot to say I also had to turn on the bootable flag of the partition using sudo fdisk -e /dev/diskX than flag 2 and quit.
    – zambotn
    Aug 3, 2017 at 3:07
  • macOS and the GUI is supposed to make things "simple and safe" for the user - writing bootable partitions can get a novice user into trouble which is why I suspect they make it unavailable in the GUI version...so long story short - it's normal. I didn't have to make the partition bootable - I just copied over GRUB to my partition and my Mac found it with no problem. I'm guessing you're booting this on a non-Mac computer?
    – Allan
    Aug 3, 2017 at 10:54
  • yes, is used to boot servers which have only BIOS mode or that can be set to so: just uEFI doesn't work for me. And about the GUI I can change my HD partitions which is far more unsafe that modify partitions of a USB drive.
    – zambotn
    Aug 3, 2017 at 13:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .