Home > Articles > Home & Office Computing > Mac OS X

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

Disk Utility

In Panther, Apple has combined its two disk-related utilities—Disk Copy and Disk Utility—into a single application (still named Disk Utility). Disk Utility (path: /Applications/Utilities/Disk Utility) can still be used to create disk images and repair volumes, and has gained a few additional features as well. To discuss Disk Utility, we'll approach it from two sides: the disk imaging aspect and disk repair features.

Disk Operations

Disk Utility combines disk repair with disk formatting and partitioning. As with Mac OS 9, you cannot use either of these functions on your startup partition. If you only intend to work with a secondary disk or partition, launch Disk Utility from the Finder. To use Disk Utility to work on your primary disk, follow these steps:

  1. Insert your Mac OS X Install CD into your computer.

  2. Start (or restart) your Macintosh while holding down the C key.

  3. Wait for the Installer to boot.

  4. Choose Open Disk Utility from the Installer application menu.

After launching Disk Utility, the application opens to display a list of your disk resources in a pane on the left side of the window, as shown in Figure 3.56. To the right of the disk list is the content pane, which displays controls for operating on the selected disk item.

Disks are listed with each of their partitions displayed. Grayed out partitions are system partitions that do not contain files that you can verify or repair.

When a disk is selected, up to five button bar selections appear in the content area: First Aid, Erase, Partition, RAID, and Restore. Each button opens a pane that performs a different function within the application, as you might guess from their names.

At the bottom of the Disk Utility window is a display of the details of the selected disk object. Although most of this information is self-explanatory, of interest is the S.M.A.R.T. (Self-Monitoring Analysis and Reporting Technology) status. A disk that supports S.M.A.R.T. can report potential problems before they occur, warning you of imminent drive failure.

Figure 3.56Figure 3.56 The left pane contains your disk resources; the right pane displays the operation you are performing on your disk.

TIP

To get more information about a disk or partition, select it in the list and then click the Info icon in the Disk Utility toolbar.

Choose the disk or partition that you want to work with and then click the tab to move to the appropriate pane. We'll start with the First Aid.

NOTE

The button bar changes depending on the object you've selected. If you choose a disk, for example, you see all the control areas. If you choose a partition, you do not see the partition controls because you can't very well partition a partition—nor can you apply RAID settings to a partition and so on.

First Aid

The First Aid pane, shown in Figure 3.57, can perform basic repair operations on a drive. It functions on UFS, HFS+, and HFS volumes—meaning that you can repair both types of Mac OS X partitions and both types of Mac OS 8/9 partitions. Unfortunately, Disk First Aid is not capable of repairing extensive disk damage, so third-party utilities such as Micromat's Drive 10 and TechTool Pro (http://www.micromat.com/) are still important parts of every software library. In addition to basic disk repair, the First Aid tools can also fix any file permissions that may accidentally have been changed while using your computer.

Figure 3.57Figure 3.57 Use Disk First Aid to repair damaged volumes.

To check or verify a disk, select the disk and partition from the volume list at the left of the window. Next, click the appropriate action button:

  • Verify Disk—Displays any errors found in your disk but does not attempt to repair them.

  • Repair Disk—Performs the same tests as Verify but automatically fixes any errors it might find. You can only repair volumes other than your boot disk.

  • Verify Disk Permissions—Check to make sure that your Mac OS X volume has the proper permissions set. If you're having trouble installing applications or deleting files, you may have a permissions problem.

  • Repair Disk Permissions—Repair any incorrectly assigned permissions. Permissions can only be repaired on your current boot disk.

  • Stop—Halts the current action (Verify or Repair).

If errors are found, they will be reported. Several things are checked during this process:

  • Extents overflow file—The Extents file keeps track of file information that could not be placed contiguously on a disk. As files become fragmented, the locations of the fragments are stored here.

  • Multilinked files—Files incorrectly linked to the same allocation blocks on the disk.

  • Catalog—Contains the information that forms the structure (files, folders) of the disk.

  • Bitmap—A binary picture of the disk, which records which blocks are allocated to files and which are free space.

If errors cannot be repaired, Disk Utility warns you that it is incapable of fixing your system. If this happens, try rerunning the repair—Disk First Aid often requires two passes to work correctly. If the repair does not work, Apple's suggested course of action is to back up the drive, erase it, and then restore your files. I'd recommend trying another disk repair tool before resorting to such desperate measures.

TIP

You can batch-repair multiple volumes by selecting several disks from the volume list. Just press Command and click the disks/partitions to add to the selection list.

NOTE

Volumes are repaired from the command line by using the fsck tool in single-user mode, as discussed in Chapter 32, "System Maintenance."

Apple also offers a command-line utility for mounting, unmounting, ejecting, and renaming disks: disktool. Learn more about the command line starting in Chapter 12, "Introducing the BSD Subsystem."

Erase

The next pane, Erase, does exactly what you would think it should: It erases drives and partitions. This is essentially a quick-and-dirty partitioning and initialization tool; it creates a single empty partition on the selected device and erases anything that was previously there. Figure 3.58 shows the Erase pane.

Use the Volume Format pop-up menu to choose between Journaled and non-Journaled Mac OS Extended partition types. Enabling Journaling does add a minor speed hit to the drive but helps protect your machine from data corruption if the system crashes or is otherwise interrupted.

TIP

You can enable journaling for a partition at any time by selecting it in the Disk/partition list and clicking the Enable Journaling button in the toolbar, or by using File, Enable Journaling (Command-J).

Journaling can be disabled by choosing Window, Customize Toolbar to add a Disable Journaling button to the toolbar and then applying it to a disk/partition, or by choosing File, Disable Journaling (Command-J).

Figure 3.58Figure 3.58 The Erase pane is used to quickly erase volumes and create a single empty partition.

Next, enter a name for the new volume. This appears as your disk label on the desktop.

TIP

If you want to securely erase the volume, click the Options button to force Disk Utility to zero all data on the drive and write random data over the drive eight times.

See Chapter 2 for more information on why multiple writes are required for a secure erasure.

Finally, click Erase to remove all existing information from the device and install the selected filesystem.

Partition

To create a more complex drive layout, use the Partition pane. Shown in Figure 3.59, this is the control center for working with your drive. Be warned—changes here will erase any information on the target drive!

The Volume Scheme section of the Partition pane contains a visual representation of the partitions on the system. Each box is a partition. The highlighted box is the active partition.

You can change a partition's size by dragging the dividers between the partitions up and down to shrink or grow the available space. As you drag the bar, the size field on the right portion of the pane changes to show the current settings.

Figure 3.59Figure 3.59 Partitioning your drive erases any existing information.

In addition to working with the visual view of the partition, you can use the various pop-up menus, fields, and buttons to set other parameters:

  • Scheme—Quickly divides your drive into 1–8 equally sized partitions.

  • Name—Sets the name of the highlighted partition.

  • Format—Sets the highlighted partition to be either HFS, HFS+, HFS+ Journaled, UFS, or free space.

  • Size—Manually enter a new size for the selected partition.

  • Locked for Editing—When checked, the Locked for Editing setting freezes the current partition's settings. You can continue to work with other partitions but not one that is locked. Clicking the lock icon in the visual view of the partitions also toggles the lock.

  • Install Mac OS 9 Disk Drivers—If this option is unchecked, the device is not usable on Mac OS 9.

  • Split—Splits the current partition into two equally sized partitions.

  • Delete—Removes the active partition.

  • Revert—Returns the partition map to its original state.

  • Partition—Commits the partition table design to the drive. This destroys all current data on the device.

Clicking the Partition button is the final step to designing your volume's layout. After you click the Partition button, you are prompted with a final confirmation, and then the changes are written to the disk.

RAID

RAID, or Redundant Array of Independent Disks, is a collection of multiple drives that function together as a single drive. By using drives performing in parallel, the computer can write and read information from the RAID set at a much higher rate than a single drive. Four common types of RAID are available:

  • Level 0 – Disk striping—This increases I/O speed by reading and writing to multiple drives simultaneously. It offers no fault tolerance.

  • Level 1 – Disk mirroring—Creates a fault-tolerant system by creating an exact mirror of one drive on another drive.

  • Level 3 – Disk striping with error correction—This RAID type uses three drives: two operating identically to level 0, and a third containing error correction information for fault tolerance.

  • Level 5 – Striped data and error correction—RAID level 5 offers the best balance between performance and fault tolerance.

Unfortunately, Panther only supports Level 0 and Level 1 in software.

RAID capabilities are easy to configure if you have multiple drives within a machine.

To set up a RAID set, drag the icons of the drives to add to a set from the volume list to the RAID pane's disk listing. Using the RAID scheme, choose what type of RAID support is enabled for the disks and provide a name for the resulting virtual drive that represents the combination of devices.

Finally, choose a volume format for the RAID set—this is identical to choosing a format for any volume—and click the Create button to generate the RAID set.

The new volume will be mounted on the desktop.

NOTE

If a drive in a RAID set ever becomes corrupted, this is reported in Disk Utility, and you are given the option of rebuilding the drive set.

Restore

The Restore pane, shown in Figure 3.60, is a new feature in the Panther release of Disk Utility. Restore enables you to completely replace the contents of a disk with a disk image that you've created previously. The disk image can even be stored on a Web server for retrieving over the network. To use restore, you must first create a disk image (we're getting there, don't worry).

Figure 3.60Figure 3.60 Restore volumes from disk images.

After an image is created, click the Image button to select it, drag it to the Source field, or type in a URL that can be used to retrieve the image.

Next, drag a disk or partition to the Destination field. If you want to erase the destination before copying the image to the drive, click the Erase Destination check box.

Finally, click Restore to start the restoration process.

TIP

The Restore feature of Disk Utility uses a command-line tool called asr. Apple has provided excellent step-by-step instructions for using asr and disk images to clone computers for classroom/workplace environments.

Rather than repeat those here, use man asr from the command line and read the section entitled "HOW TO USE ASR." Read more about the command line starting in Chapter 12.

Additional Disk Operations

The toolbar contains options for unmounting/mounting volumes. After selecting a disk or partition from the list, you can choose to Mount (Option-Command-M), Unmount (Option-Command-U), or Eject (Command-E) the volume.

Disk Imaging

Disk images have become a common and convenient way to distribute software for Mac OS X. Rather than create an archived folder, developers write their applications to a virtual disk that is loaded into memory when used. This disk appears to the computer as a real disk and can be manipulated like any other disk. For the end user it is a simple way to work with new applications. A single disk image file can contain applications, support files, and any other data a program might need—and it never needs to be decompressed. In fact, many applications can actually run directly from disk images, without needing to be copied to your hard drive at all. Disk Utility even has built-in CD burning capabilities to make turning a disk image into a real CD a matter of a few clicks.

Adding Disk Images to the Interface

To work with an existing disk image, drag the image file into the disk list pane of Disk Utility or use Image, Open (Option-Command-O). It is added to an area below your standard hard disks and remains there until you drag it back out (even between executions of Disk Utility).

To mount an image you've added to Disk Utility, either double-click its name in the disk list pane, or select it and choose Open from the toolbar.

From this point, you can work with the disk image much like you would with any other disk in Disk Utility. You can verify it, repair it, repartition it, and so on.

Creating Disk Images

Disk Utility can create images as well as mount them. This is useful for creating an exact duplicate of software you don't want to lose, or for making a master image for distributing software over a network with asr.

There are three ways to generate an image: Copy an existing volume/partition; copy an existing folder; or create an empty image file, mount it, and then copy files to it.

To create an empty image file, choose Images, New, Blank Image. Figure 3.61 shows the disk image creation dialog box.

Figure 3.61Figure 3.61 Generate a new blank image; then copy files to it.

Fill in the Save As field as you normally would—this is the name of the image file, not the volume that is going to be created. Choose a size for the image from the Size pop-up menu. There are a variety of preset sizes for common media, such as Zip disks, CDs, and DVDs, and a Custom setting for arbitrary sizes.

Next, choose a volume format with the Format pop-up menu. You can choose between a read/write disk image, which occupies the exact amount of space you've set for the image, or a sparse image that grows to accommodate the files you add.

Finally, if you want to encrypt the disk image, choose AES-128 from the Encryption pop-up menu and then click Create. The new disk image is created and added to the Disk Utility disk pane immediately.

Creating an image from an existing drive is even easier. Highlight the partition you want to use; then choose Images, New, Image From Device where Device is the name of your selected partition.

You are prompted for the location to save the image. Using the Image Format pop-up menu, choose the type of image to create: read-only, read-write, compressed, or CD/DVD master. Apply encryption to the image file by choosing AES-128 from the Encryption pop-up menu. Click Save to copy an image of the device onto your hard drive.

TIP

Read-only images are a good way to distribute software because they do not allow any changes to be made to the image. This results in an image that cannot be modified or tainted and can always be assumed to be a working master copy.

The third way to create an image is to copy the contents of a folder or volume. This is the easiest means of building a disk image if you have all the files in a subfolder of your volume, or want to create an image of a mounted network share. It also results in a disk image that is unfragmented because it isn't based off a direct device copy.

Choose Images, New, Image from Folder; then use the Mac OS X file browser to pick the folder or volume that you want to use. As with the other two imaging methods, choose the image file and format when prompted, and click Save to create the disk image file.

Burning CDs

To burn a CD from within Disk Utility, you must have your CD writer connected and powered on. Select the Image you want to burn; then choose Images, Burn or click the Burn toolbar icon. If the image is suitable for CD burning, Disk Utility displays the dialog shown in Figure 3.62.

Click the disclosure pushbutton to choose the maximum speed you want to use during the burn process, along with whether you want to burn additional copies of the image, verify the burn, and eject or mount the disk after it has finished.

When you're satisfied with your settings, click the Burn button, and Disk Utility begins writing the CD.

Figure 3.62Figure 3.62 Insert a CD and click Burn.

Other Disk Image Operations

Using the Images menu, you can Verify disk images, Convert them to other formats (such as read/write to read-only), calculate checksums, and scan the image for restore. Scan the Image for Restore is a step required before using the image with the Restore feature of Disk Utility.

Disk Utility Menus

Although most options for Disk Utility are found in the toolbar or via controls in the various panes, two additional features are located in the File menu.

The first, File, Log, displays a log of the Disk Utility operation, including repairs, partitioning, and so on. The second—File, Fix OS 9 Permissions—can be used to solve permission problems that may cause OS 9 not to boot or function correctly. Choosing Fix OS 9 Permissions automatically fixes the permissions on the appropriate volume; you do not need to select a volume or partition first.

  • + Share This
  • 🔖 Save To Your Account