Computers can develop many problems, including hardware damage and defects, operating system and application issues, and malware. While Macs tend to have lower incidences of some of these problems (malware in particular), they aren't immune to having issues that require some diagnostic and repair work.
Some of the most common problems that Mac users experience have to do with hard drives. Hard drive problems come in two general types: physical damage to the drive itself, and directory or file system damage. Physical damage is less common but more severe, because the driveor, in rare cases, the circuitry that connects the drive to the motherboard of the computer, known as the drive controllerno longer functions. Repairs for physical damage typically require replacing the drive, often without being able to recover the files stored on that drive. (I'll talk about data-recovery tools and options in a future article.)
More commonand much easier to fixis damage to the directory structures and the file system on a hard drive (or a removable drive, such as a flash drive or camera memory card). The directory structures of a drive are created when the drive (or partition) is formatted; they act as a map to the sectors or blocks on a disk where the data is stored. These structures are important because they enable the Mac to locate the pieces of data that make up a file. If a directory is damaged or corrupted, you may not be able to locate or open files, applications may behave erratically, or the Mac may not start from the affected drive.
In cases severe enough to render the Mac unable to boot from a drive, typically you can use an alternate startup disk, such as another hard drive or partition, a Mac OS X install or restore DVD, a hard drive utility DVD, or a disk inserted in another Mac (such as is required for the MacBook Air or Mac mini server, which ship without a built-in DVD drive). In these cases, you may be able to see and access the affected drive, or the drive may have suffered damage or corruption bad enough that the Mac will be unable to mount the drive at all. Even if the drive is accessible, you may want to use a utility to determine the type and extent of the damage (and rule out physical damage) before attempting to open or copy files. In these situations, you may not be able to open or copy files that are affected by the directory corruption.
In addition to problems with directory or file systems on a drive, the file permissions on individual files or folders may become corrupted or may be set improperly. This situation can lead to issues ranging from not being able to open a file or application, to erratic behavior of affected applications, or even to erratic behavior and lack of access to system components of Mac OS X (such as Apple-provided utilities, or configuration options such as those in System Preferences). Improper permissions can also have the opposite effect, giving users or applications greater access to core system files and settings than they should normally have.
Permissions on system and application files are specified by package (.pkg or .mpkg) files that are read by the Mac OS X Installer utility. All the Mac OS X system files, as well as files by most third-party applications, are bundled as package files. Some applications don't use packages because you only need to copy a single application file to your hard drive to install the app, or because the application is installed by a third-party installer (though such installers are much less common today than in the past).
After the Mac OS X Installer utility places application files in the appropriate locations with the appropriate permissions, it writes a copy of the package to a special Receipts folder, which is located either in the Library folder at the root level of a startup drive, or in the Library folder of your home folder. This design allows various tools to verify or repair (if needed) the permissions of both system and application files.
For the four utilities covered in this article, I'll describe how various tools can be used to solve these types of problems. I'll also cover additional features that the tools provide for preventing and resolving problems, as well as for working with advanced hard drive and data features.
Disk Utility is a powerful tool that's part of every Mac OS X installation and available from the Mac OS X Install and Restore DVDs. Although it's a free tool provided by Apple, Disk Utility can diagnose and resolve a range of hard drive issues, and it offers a set of features beyond basic disk setup and repair.
For diagnostic purposes, Disk Utility offers the ability to verify the directory structures and file systems of a hard drive or partition (called First Aid). It also can verify the permissions on all of the Mac OS X system files, as well as any applications installed via package files. If problems are detected with either the directory structures or permissions, Disk Utility can attempt to repair them.
In repairing directory structures and file systems, Disk Utility looks at the actual content on a drive or partition and adjusts errant directory entries to match the condition of the drive. Disk Utility is often successful in such repairs, but the routines that it uses may not always be able to restore the drive. In these cases, you can try other utilities. In the case of permissions, Disk Utility is almost always able to repair permissions, as long as the files written to the Receipts folders aren't moved or deleted.
Disk Utility can also query hard drives for their S.M.A.R.T. status , which can indicate hardware problems or physical damage. Such problems cannot be repaired by a hard drive tool; they generally require replacing the driveor at least backing up data if the drive is still readable.
In addition to diagnosing and repairing problems, Disk Utility can partition or repartition hard drives into multiple volumes, typically without needing to erase the drive in the process, which was required in older versions of Mac OS X. You also can use Disk Utility to clone the contents of one hard drive to another (called a restore) and create disk image files.
Disk image files are displayed with a .dmg extension. When opened, they mount on the desktop like a hard drive or removable disk. They can be used as a way of packaging a number of files for easy storage, or for transfer by email or other means. You can also clone an entire hard drive as a disk image to use later for a restore option or as a backup; this is a common approach for businesses and schools that must deploy a number of identical Mac systems.
When creating disk images, you can tell Disk Utility to compress the data to save space while copying it to the image. You can also opt to create encrypted disk images that can only be opened with a password that you enter when creating the image. This makes the images useful as a secure storage solution for sensitive or confidential files.
You can also use Disk Utility to mount or eject disks. If a disk doesn't mount automatically, or if a non-removable drive has been "ejected" (unmounted), and therefore it's not accessible to the Mac, you can use Disk Utility's Mount command. For some disks that have sustained either physical damage or directory damage, this capability may provide access to files and folders. Finally, Disk Utility offers the ability to erase a hard drive, partition, or external/removable disk (including flash drives, camera memory cards, and rewritable CDs/DVDs).
When erasing a drive or partition, you can use a simple erase, in which sectors on the disk are marked as free and used to store new data as needed, or you can choose from a variety of secure erase options that write over those empty sectors with blank replacement data. You can erase in one pass, seven passes (the U.S. Department of Defense's definition for a secure erase), or 35 passes. The more secure the erase option you choose, the longer the erasing process takes, because the entire drive must be overwritten that many times.
In addition to erasing an entire drive, you can simply erase the free space of a drive. This option securely erases any sectors on the drive that are marked in the drive's directory as not containing active data. It securely erases any previously deleted files (but not files that are currently in the Trash). The Secure Empty Trash feature in the Finder also performs this function, but using only a single-pass erase, and it affects only files that are currently in the Trash. Using Disk Utility, you can perform more secure erasures of previously deleted files.
With this powerful set of tools, Disk Utility may be the only hard drive utility that most users will ever need.
The three tools I'll cover in the remaining sections of this article are commercial hard drive utilities. They all offer the same basic features as Disk Utility, but each tool has its own set of additional features and capabilities that make the tool worthy of investment.