Publishers of technology books, eBooks, and videos for creative people

Home > Articles

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Backing Up and Restoring Mac OS X Volumes

Here's some advice you should already know: Back up the files on your drive(s)—and do so often! If a file on your drive gets corrupted or accidentally deleted and you don't have a backup, you may not be able to retrieve it. When this happens, you'll be glad you had a backup.

The danger posed by a lost or corrupted file may not seem serious if the file in question is a freeware program you downloaded from the Web. In that case, you can just download it again. Even here, though, if a problem destroyed a folder containing hundreds of such programs, it would be a real pain to remember everything you lost and then reacquire all of the software. More serious is the loss of irreplaceable files such as the near-final draft of a novel you spent the last two years writing.

To prevent such disasters, it's usually sufficient to back up just the files you've acquired, and, especially, the documents you've created. For these purposes, you don't need to back up your entire drive but instead can restrict your backup to your home directory.

If you've installed applications in the Applications folder or added fonts to the /Library/Fonts folder, you may also want to back them up—especially if the software didn't come on a CD that could serve as a backup. But remember: Reinstalling applications from their installers is often better than just saving a backup of the application itself because an installer utility will install any accessory files (including invisible files), which you would not save by backing up just the application.

Note: If you've been using Classic, you may also want to back up your Mac OS 9 folders—System Folder, Applications (Mac OS 9), and (especially) Documents—to save any critical files and simplify a restore later.

There is, however, a good reason for maintaining a complete backup of your entire drive: If it becomes damaged in such a way that you need to either erase and reformat it or get a new drive, the simplest and fastest way to get up and running again is to restore the drive in its entirety from a current backup.

That being said, restoring a Mac OS X startup volume presents some unique obstacles, the most critical of which is making sure your backup and restored volumes are bootable. Unlike what you can do with Mac OS 9 volumes, you can't create a bootable copy of a volume via drag and drop in the Finder. If you try to do so, the following problems occur that prevent the copy from booting (or even from being a complete copy!):

  • File permissions are not preserved correctly.
  • Invisible files, especially the critical Unix software, are not copied.
  • Unix symbolic and hard links are broken.
03fig21.jpg

Figure 3.21 Left, Apple's .Mac's Backup utility; right, the Sync options from the .Mac System Preferences pane.

Backing up Mac OS X: Utilities for volume backups

Fortunately, the problems with backing up and restoring a Mac OS volume can be easily solved with a number of readily available utilities. These are especially good at creating a full, bootable "clone" of your startup volume.

Third-party backup utilities

Although you can back up and restore volumes using just the software that came with your Mac, the best, most reliable methods employ third-party software. Thus, I'll begin my discussion with these.

  • Prosoft's Data Backup has an exceptionally clear interface that allows you to choose different types of backups, such as the following:Clone. Creates an exact duplicate of the drive—the best option if you want a complete, bootable copy of the drive. Older files present on the backup but no longer present on the main drive will be deleted from the backup.Incremental. Adds new files to the backup but does not delete old ones—best if you want to keep old versions of documents and applications as an archive.Synchronize. Ensures that two folders or volumes are "in sync," copying in both directions, always preserving the newer version of a file. Note that if you delete a file from your main drive, it will also be deleted from the "synchronized" volume; similarly, if you delete a file from the backup, it will be deleted from the main drive. A variation of this approach, a unidirectional synchronization, is essentially the same as a clone (or mirror).
  • EMC Dantz's Retrospect for Mac OS X is the Mac OS X version of the gold standard of Mac OS 9 backup utilities. It includes numerous features that other backup utilities do not; however, one consequence of being more powerful is that it is also not quite as easy to use. One especially nice feature: It allows you to restore files while you're booted from the Mac OS X volume that's the intended destination.
  • Carbon Copy Cloner is a shareware utility that uses Unix's ditto command to make backups. The author's Web page (www.bombich.com/mactips/image.html) provides many more details about backing up Mac OS X volumes via Unix.
  • SuperDuper! is another excellent shareware utility. It features a unique safety clone feature that allows you update to a new version of Mac OS X while keeping the ability to quickly revert back to the prior version, should you need to do so.

Disk Utility

If you want to make a full backup of a volume using just Mac OS X utility software, use Disk Utility's Image and Restore features, which provide you with two options: You can back up and restore a volume directly, or you can create an image file for backup and restoring.

To back up and restore a volume directly:

  1. Launch Disk Utility, and in the window that appears, click any volume from the list at the left, and then click the Restore tab.
  2. From the list in the left column, drag the volume you wish to back up to the Source text box. Although your currently active startup volume can be used as the source, I would advise against it (that is, you should start up from another volume instead). For example, the active startup volume may impose permissions restrictions that prevent a successful complete backup.
  3. From the list in the left column, drag the volume you wish to contain the backup to the Destination text box. Note: Make sure the Ignore Ownership on This Volume option is not selected in the Finder's Get Info window for the Destination volume.
  4. Check the Erase Destination box. If you do not select Erase Destination, the restore will add to the existing contents of the Destination volume rather than replace it—typically not what you would want.
  5. Click the Restore button at the bottom of the window. If you have permissions problems when creating a backup (for example, you get a "Permission denied" error or other problem), log out and log in as the root user (or simply launch Disk Utility as root, using a utility such as Pseudo, as described in Chapter 4), and then try the above again.

Assuming that both volumes you selected were hard-drive volumes, this should back up the source volume to the destination volume.

If the source volume was bootable (for example, it was a volume from which you could start up in Mac OS X), the backup should be bootable as well (see Chapter 5 if you're having problems booting).

To restore from the backup you created, reverse the above procedure—that is, start up from the backup copy you made and restore to your original volume location.

To back up to and restore from a disk image:

  1. Launch Disk Utility, and from the list in the left column select the volume you wish to back up.
  2. From the File menu choose New, and from the submenu select Disk Image from {name of selected device}. The name of your selected volume should appear as the device name; however, it may appear as something like "disk0s3 (volumename)."
  3. In the Convert Image window that appears, do the following:
    1. Enter a name for the image.
    2. Choose an Image Format. "Read-only" is the best choice overall; however, you should choose "compressed" if you need to create a smaller image so that it will fit on the destination volume.
    3. Leave Encryption set to None (unless security of the image is a concern).
    4. Select a destination volume via the Where pop-up menu (or navigate to the desired destination location if you've expanded the dialog to view the file browser). This volume must be large enough to contain the image (plus temporary storage that may be needed while creating the image, which means the volume should have at least twice as much free space as the image itself will need).
  4. Click Save and wait for the image to be saved. If you run into permissions problems when attempting to create the image (for example, you get a "Permission denied" error or other problem), log out and log in as the root user (or simply launch Disk Utility as root, using a utility such as Pseudo, as described in Chapter 4). Try the above again.
  5. From the Images menu, select Scan Image for Restore. In the window that appears, select the image you just created and click Open. This verifies that an image can be used for restoring. The image is now saved and ready to be restored.

If desired, you can burn the image contents to a CD or DVD (assuming they fit) by selecting the image and clicking the Burn icon in the toolbar. This copies the "mounted" contents of the image to the CD or DVD, not the actual .dmg file itself. You can also copy just the .dmg file without using Disk Utility: Drag the .dmg file's icon to a mounted, unused CD-R or DVD-R in the Finder and burn the disc.

To restore from the image file:

  1. Launch Disk Utility, and in the window that appears, click the Restore tab.
  2. If the image you created is in the left column, drag it to the Source text box. If not, click the Image button, and then locate and select the image.
  3. Drag the name of the volume to be restored from the left column to the Destination text box. Keep in mind that this cannot be the current startup volume, because if it is, the destination volume will be erased.
  4. Check the Erase Destination box.
  5. Click the Restore button at the bottom of the window.

The volume should now be restored. Wait until restoration is complete; then restart from the restored volume.

03fig22.jpg

Figure 3.22 Disk Utility's Restore pane.

03fig23.jpg

Figure 3.23 Left, Disk Utility's File > New submenu; center, Images menu; and right, New Blank Image dialog (accessed through File > New > Blank Disk Image).

Using Terminal

If you're comfortable with using Terminal, you can back up a volume with Unix commands. The following provides an overview of what you need to know:

  • ditto. The ditto -rsrc command copies directories (and their contents), correctly maintaining all permissions settings and copying any resource forks. As a result, ditto is a good choice for making a clone backup of an entire volume—one that will be bootable, if necessary. In fact, Carbon Copy Cloner is a front end for the ditto command, bypassing the need to use this command in Terminal.Note: Make sure you are using a version of Carbon Copy Cloner that has been updated to work with Tiger. This applies to any third-party backup utility.
  • rsync. The rsync command acts as a directory synchronization tool. Compared with ditto, rsync adds the option to copy only files that are new or that have changed from an existing backup, thereby reducing the time needed to complete the task. Its disadvantage is that, like cp, it does not preserve the resource fork. The solution here is a variation on rsync that copies resource forks: RsyncX, from MacEnterprise.org (www.macosxlabs.org/rsyncx/rsyncx.html).
  • asr. As noted in "Technically Speaking: More About Disk Utility's Image and Restore Features," the asr command may be used to "clone volumes" (that is, make full bootable backup copies). You can use it instead of Disk Utility's Restore feature.

Backing up Mac OS X: Hardware strategies

Over time, the preferred backup hardware has changed, just as the common backup media has shifted (for example, from floppy disks to DVDs) and typical hard-drive capacity has increased (for example, from 20 MB to 100 GB and more). Backup hardware also varies as a function of the type of data you're backing up (a few files versus an entire disk).

Here are my current preferred backup choices. (You may find that using a combination of them provides the best option of all!)

  • CD-RW or DVD-RW drive. You use a CD-RW or DVD-RW drive to back up data to CD-Rs or DVD-Rs—primarily for a limited subset of your data (in particular, data that doesn't change often or that you would not be able to replace). In general, you can use the Finder to perform these types of backups. This method is perfect, for example, for backing up your MP3 music library, your collection of family digital photos, or the manuscript of that novel you're working on. It provides the most reliable way to store these files without risk of the backup itself becoming damaged or inaccessible. You can use this method (especially DVD-R) to back up an entire drive, though you won't want to do so often because it's likely to be very slow. You can also use RW discs in order to perform later backups with the same media; however, I recommend against this because writing to these discs is significantly slower than to the write-once media, and the discs are also more prone to becoming unreadable at some later point.If you're using CD-Rs (or similar media of limited size) and are unable to fit the entire contents of a directory onto one disc, you can divide the contents across as many discs as needed. Your only problem would be if you had a single file too large to fit on one disc. In that case, you might want to use a utility like StuffIt Deluxe, which can create a segmented archive of the file; each segment can then be stored on separate media. Apple's Backup application can also back up across multiple CDs. Additionally, you can create a segmented set of .dmg files (as noted in "Technically Speaking: More About Disk Utility's Image and Restore Features," above). However, I recommend using media that can contain the entire file or volume (if possible): It's much faster and less tedious.
  • Tape drive. A tape drive used to be a great choice for maintaining a regularly updated backup of an entire volume. However, with FireWire drives adding greater capacity for less money every year, it is often more economical (and certainly faster) to back up to another hard drive. Still, if you have a large amount of data that you want to archive and store, tape can be the preferred choice.With a tape drive and Retrospect, it's also easy to perform incremental backups. That is, you can instruct Retrospect to only back up files that have changed since the last time you backed up (saving time over a complete backup), and you can have it so that Retrospect does not overwrite old versions of files when adding new ones. This latter option is especially useful for frequently changing files: If you discover that an old "deleted" version of a document contains a passage you want to retrieve, you may still be able to recover that particular version of the document.
  • Hard drive: Individual file backup. If you've got an external hard drive—for example, one that connects via FireWire or USB—you can use it to quickly and easily back up individual files and folders. You simply connect it to your computer, drag the files and folders you want to back up, and then disconnect it.
  • Hard drive: Full backup. You can also do a full "mirrored" backup of a volume to another hard drive. This is especially useful if all you want to do is back up the internal drive in a single Mac. You can use Retrospect for this task (in exactly the same way that I described for tape drives); however, Retrospect includes another option, called Duplicate, that I recommend instead. Here's what to do:
    1. Get an external FireWire drive equal to or larger in size than your internal drive.
    2. Format it with the same number and sizes of partitions as your internal drive.
    3. Use Retrospect's Duplicate option to create a duplicate of the drive. (You will have to do this separately for each partition.)

    With this method, instead of storing your data in a Retrospect archival file format, Retrospect creates a duplicate of each file, much as the Finder would do. Unlike the Finder, however, Retrospect copies all files (including invisible files) and maintains all permissions and links correctly. The result is an exact duplicate of your hard drive. You can even boot from it.

    Do this backup as often as you feel necessary.

    With Retrospect and a hard drive (or multiple hard drives), you can do regularly scheduled incremental backups—great for users who need to back up an entire volume every day, or even every few hours.

    You can also use the previously mentioned utilities (such as Data Backup X and Carbon Copy Cloner) to do a mirrored backup of a hard drive.

  • Internet. You can back up to a server on the Internet. Apple's .Mac, especially in combination with its Backup utility, is the best-known example of this for Mac users. Although it is slow (and potentially expensive for large backups), it has the advantage of being off-site. If disaster strikes (such as a theft or fire in your home), these Internet backups will still be available. Unless you maintain physical backups somewhere else (such as by placing backup CDs in a safety deposit box or storing them at a friend's or relative's home), this is the only protection you will have against such disasters.

See also the following Web pages for more background on the Unix backup commands: "How to Create a Bootable Backup of Mac OS X (Cloning Mac OS X discs)" (www.bombich.com/mactips/image.html) and "Learning the Mac OS X Terminal, Part 5" (www.macdevcenter.com/pub/a/mac/2002/07/02/terminal_5.html).

  • + Share This
  • 🔖 Save To Your Account