Creating a bootable USB disk
Thanks to gdisk on Linux, I saw the location and size (650MiB) of the Recovery Partition and used it to create a bootable disk. The tool you use to display the table (gdisk, gpt…) will tell you the bytes per sector of your disk at the top. Be sure to use that value in the "bs" option to "dd". Note that I had to use the whole disk (/dev/disk[n]) and "skip=" because the "special" GPT partitions did not have numbers and therefore did not have assigned devices.
unix# dd if=/dev/disk[n] of=/dev/[boot disk] \
bs=[bytes per sector] skip=[start sector of recovery] \
count=[number of sectors in recovery]
OS X and NetBSD display the partition sizes which is convenient but Linux uses "start-end." You might need to add 1 to the subtraction. Just make sure that "start + size = beginning of next partition." i.e. sequence 1-10 has 11 integers.
It worked! I was able to enter OS X's recovery environment. The OS could see the "Systems" partition so I had to unmount it repeatedly whenever I made a change to the table using "gpt." Any partitions that became "valid" were automatically mounted as well so this became a chore but its nuisance was overshadowed by my relief. Things were looking up!
I imagine that there might be someone reading this guide who has a disk with different sector sizes. In such a case, you "might" need to calculate the correct sector count for system partitions or free spaces that have specific sizes. e.g. my disk, like most, uses 512 byte sectors so my "Recovery HD" partition (650MiB = 1269536x512) on a disk with 4KiB sectors "might" be 650MiB = 650002432/4096 = 158692 sectors. I say "might" because I haven't used these new disks and I've read that they have firmware that can translate between 512B and 4KiB sectors.
If you are in this Operating Room, then you should be prepared to handle such gory details. As long as you have your table backed up and you don't write to the data sections, you'll find that OS X is quite informative about this whole business. It won't mount partitions it can't recognize and it will tell you about incorrect extents of a partition that has a correct start.
Unmount any partitions that are recognized whenever you issue a successful "gpt" command.
mac# diskutil unmount /dev/disk[n]s[n]
Display partition table. You can use "gpt show disk[n] -l" to see the labels. Without the "-l" you'll be able to see the partition GUID's which are important.
"mac# gpt show disk[n]"
Scalpel! This is a delicate procedure.
gpt options: [-b start sector], [-s sector count], [-t GUID], [-i partition index]
Add EFI System Partition
mac# gpt add -b 40 -s 409600 \
-t C12A7328-F81F-11D2-BA4B-00A0C93EC93B -i 1 disk[n]
Add Mac OS X Partition
mac# gpt add -b 409640 -s [size] \
-t 48465300-0000-11AA-AA11-00306543ECAC -i 2 disk[n]
Add Recovery HD
mac# gpt add -b [start sector] -s 1269536 \
-t 426F6F74-0000-11AA-AA11-00306543ECAC -i 3 disk[n]
For user-created partitions, remember to subtract 262144 sectors (128MiB) if you are missing partition info between valid partitions. In my case, "Mac Users" is at the end of the disk but I had to add 262144 to the end of "Systems" to get the correct start sector and subtract 262144 from the last disk sector to get the right size.
???!!! I could not believe my luck as OS X started auto-mounting my partitions! I'm glad that it was just a case of incorrect GUID labelling. MBR partition types were much easier to modify. Perhaps this added difficulty will be a deterrent to excessive experimentation with GPT disks. The tools, in ALL OS's, definitely need to be improved, though.
Apple GPT technote
Wikipedia GPT entry
Apple gpt manpage
In closing, I'd just like to express my admiration of OS X. As much as I dislike Apple, OS X is an excellent Operating System. The marketed and perceived simplicity of the system belies its unix certification. OS X does, with subdued confidence, what Linux keeps promising with brash sanctimony. I may never buy another Apple product but they have created a system that: