I have a flash drive that I use for various diagnostics on macs. Most of the partitions on the drive are accessible by holding down the option key on boot. I also have one extra partition that is not bootable and used strictly for diags after the macs OS has loaded. My challenge is finding a way to not mount all the option boot partitions when trying to use the non bootable one.

Any ideas? Thanks

  • Do you have any control over the running OS? In other words, are you connecting this drive to running computers to run the applications on that partition? Or will that partition only be used when you boot to one of the other partitions on the drive? The best solution depends on the answer. – Christian L Jan 30 '12 at 17:18
  • For example, i want to boot the mac to snow leopard, then insert the flash drive and have it mount only the partitions that are not bootable. My flash drive has 16 partitions that I can choose from when inserting the flash drive and holding option during boot. But when I want to boot to full OS and use the diags on the 17th partition (not option booting)I have to wait for all 17 partitions to mount. Hope that clarifies? – Munchkinone Jan 31 '12 at 2:25
  • @ChristianL Would you know a solution to run apps on that partition please ? – Jean-Charbel VANNIER Mar 7 at 17:06

Borrow a trick from Apple - set the partition type to something besides Apple_HFS. The Apple_Boot partition type is used by Lion Recovery, and should provide the exact behavior you want. This process is NOT for the faint-of-heart, and you should definitely have a backup. If any of this process is unclear, DO NOT DO IT. Note that all numbers and drive names will be different on your computer.

First, determine which "BSD disk" your target drive is. Very likely disk1, but not necessarily. For example, this is my current system:

bash-3.2$ diskutil list
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *120.0 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh SSD           119.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:                  Apple_HFS Secondary HD            319.7 GB   disk1s2

What follows is a copy-paste-edit job from Dmitry Dulepov:

We need to change the type of this partition. This involves noting partition parameters, deleting and creating a patition with gpt. Firsts, let find out parameters:

bash-3.2$ sudo gpt show disk1
         start       size  index  contents
            0          1         PMBR
            1          1         Pri GPT header
            2         32         Pri GPT table
           34          6
           40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
       409640  246725744      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
    247135384     262144
   247397528    1269528       3  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
    248667056    1402591
    250069647         32         Sec GPT table
    250069679          1         Sec GPT header 

Next, delete and add the partition. Note that we use values found on the previous step.

bash-3.2$ sudo gpt remove -b 247397528 -s 1269536 -t 48465300-0000-11AA-AA11-00306543ECAC disk1
disk0s3 removed
bash-3.2$ sudo gpt add -b 247397528 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC
disk0 disk1s3 added

Notice the different GUID. That is important because it tells OS X the type of the partition.

Check if everything is ok:

bash-3.2$ diskutil list disk1

You should see what had previously been an Apple_HFS partition should be listed as Apple_Boot. Such partitions are bootable on an Intel Mac without being auto-mounted by a running system. Repeat this general process with each partition that you want to "hide" normally.

  • Thanks, i tried following your example by taking a 1gb usb drive and creating 2 500 mb partitions. I then opened terminal, listed the available drives, found my usb drive and tried to do "sudo gpt show diskX" and kept getting the response that the resource was busy. I made sure I closed disk utility, but still could not show the drive partitions. – Munchkinone Feb 3 '12 at 2:51

You must log in to answer this question.

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