Force a read-only mount of startup disk

bootfirmwarehard drivekernel

I want to create a MacOS recovery startup disk on a USB flash drive. In order to maintain the integrity of the drive's contents (and, perhaps more importantly, reduce write wear on the flash drive from tmp files, swapping, SpotLight, etc.), I'd like to be able to have the kernel mount the drive read-only (but otherwise boot into a full-featured desktop environment where various GUI-based recovery tools are available).

This is obviously possible when booting from CD/DVD (and probably when booting from a flash drive with a physical write-protect switch), but I suspect the hardware state just magically causes the kernel/bootloader to do the right thing.

Back in the day, I recall that some systems had the ability to specify boot arguments that would force behavior like this. Scanning the OpenFirmware command and MacOS boot-args cheat sheets reveals nothing obvious.

Is there any way to request that the firmware or kernel make the boot device be read-only for a multi-user boot? Or, alternately, is there a way to continue startup from single-user mode while keeping the boot device in a read-only state?

Best Answer

The install CDs took a lot of shortcuts to deal with read-only boot volumes. One of the tricks is to mount the swap partition in a ramdisk - yes, it sounds rather pointless to swap your RAM to another part of memory, but I expect it was easier to do that than to rewrite the kernel to not swap at all. Make the GUI single-application and you won't need swap anyway.

If you are making a maintenance drive rather than a one-task USB installer I would recommend a spinning external. Faster than most USB thumb drives and it will have enough space to recover data. Get a 500Gb external, partition it into a 50Gb boot volume with CCC, DiskWarrior, DataRescue and whatever else you like, a standard recovery partition, and the rest for user data.