When hard-drive disaster strikes, you need to start up your Mac from another drive to repair it. In days gone by, you would typically boot from the install CD or DVD that came with your Mac (assuming you could recall where you stashed it) and run Apple’s Disk Utility from there. But today’s Macs no longer ship with any optical disc—heck, most Macs ship without any optical drive. So what do you do instead? Your best bet is to prepare ahead.

Create an emergency flash drive

An emergency drive contains only the essential software you need to boot your Mac and run troubleshooting utilities (such as Apple’s Disk Utility). I recommend using a USB flash drive (8GB is sufficient) rather than an optical disc. Flash drives are superior because they work with Macs that no longer contain an optical drive, and you can update them as necessary.

You can see the Repair Disk button, but you can't click it. How do you solve this problem? It pays to prepare ahead.

The Recovery Disk Assistant method: One way to create your own emergency drive is via Apple’s Recovery Disk Assistant. This tool is simple to use, but requires that you already have a dedicated partition on your Mac’s hard drive called Recovery HD. If you installed Lion or Mountain Lion on a supported hard-drive configuration (your Mac must have an internal drive formatted with a GUID partition scheme), chances are good that it’s there.

You can check to see if you have the partition by restarting your Mac and then holding down Command-R. Or, restart while holding down the Option key. A screen should appear with Recovery HD as one of your options.

You can't create an emergency flash drive using Apple's Recovery Disk Assistant unless your Mac already includes a Recovery HD partition.

Why do you have to have a partition on your Mac to be able to create the emergency drive on an external device? It's probably because Disk Assistant requires the data on the partition to create the external drive. If the partition is missing or corrupt, you'll see an error.

Download the OS X Recovery Disk Assistant from Apple’s Support site. Connect your USB flash drive to your Mac, launch OS X Recovery Disk Assistant, select the drive, and then follow the on-screen prompts. This is a quick and easy process.

The do-it-yourself method: Lacking the Recovery HD partition on your startup drive isn't the only reason you might skip using Apple's Recovery Disk Assistant. In some cases, an Assistant-created drive will work only with the Mac that made it. Luckily, you have another way to create an emergency flash drive.

First, you need a copy of the Install OS X Mountain Lion app. (Check in your Applications folder.) Even if you previously had this utility, it may no longer be on your drive, because OS X unhelpfully deletes it after you use it. If it’s missing, redownload it from the App Store by selecting Apple menu > App Store. You may need to hold down the Option key when you choose Purchases to make the app show up.

Next, you have to extract the InstallESD.dmg file from the app’s package; this is the file you’ll use to create the install drive. Right-click (or Control-click) the Install OS X Mountain Lion app and choose Show Package Contents from the contextual menu that appears. A folder will appear. Open Contents and then open Shared Support. Inside you'll see the file InstallESD.dmg.

Lacking the Recovery HD partition on your startup drive isn't the only reason you might skip using Apple's Recovery Disk Assistant.

Launch Disk Utility (inside /Applications/Utilities) and then drag the InstallESD.dmg file onto the left side of the Disk Utility window. In Disk Utility, select the file and then click Open to mount the disk image in the Finder. Select Mac OS X Install ESD in the Disk Utility sidebar, and click Restore. Drag the Mac OS X Install ESD icon into the Source field on the right.

Now it's time to get your flash drive ready. This process will erase the drive, so make sure it no longer holds any data that you want to keep. Connect the drive and then find it in Disk Utility. Drag the flash drive into the Destination field. Click Restore and then Erase in the resulting dialog box. You may need to enter an administrator username and password. It may take some time for the drive to format. (For more details, see “How to make a bootable Mountain Lion install drive.”)

This method won't work for everyone. For starters, if you own the 13-inch MacBook Pro with Retina display or one of the newest iMacs, such models use a special version of OS X 10.8.2 not available from the Mac App Store. You should either use the Recovery Disk Assistant method or wait for OS X 10.8.3. Also note that, if you have a new iMac with a Fusion Drive, Apple states that the “version of Disk Utility that comes with Fusion Drive is unique. Earlier versions of Disk Utility can’t be used with a Fusion Drive.”

Clone your startup drive

When trouble strikes, you can boot from a 'clone' of your hard drive to make repairs. Utilities such as SuperDuper can help.

Looking for an alternative to making an emergency drive? Here’s another way to go: Make a clone of your startup drive. A cloned drive is an exact copy of the original, which means you can boot from the cloned drive just as you can (or once could) from the original.

A cloned drive, of course, also serves as a useful backup of all the data on the original drive, and will let you get up and running quickly if your first hard drive fails. (See “Bulletproof backups” for more about why it’s a great idea to have a bootable clone of your hard drive.)

Clone your drive using a utility such as Bombich Software’s $40 Carbon Copy Cloner or Shirt Pocket’s $28 SuperDuper. You will need an external drive that is as big as your startup disk.

Ready for the worst

With your emergency measures in place, you’re ready for the worst. What then? Look for an article next week about what to do when your hard drive starts showing signs of trouble.