File System Troubleshooting
Because a functional file system is required by the operating system, the software that drives the file system is very reliable. In fact, most file system failures are due to bad hardware or media. It doesn’t matter how good the software is, though; if the hardware is no longer reading or writing bits, it’s pretty much useless to the file system. If, during troubleshooting, you determine that catastrophic hardware failure is the problem, there really isn’t anything you can do from a software perspective to repair the device. Only a data recovery service, such as DriveSavers, might have a chance at recovering your data.
Conversely, if you’re experiencing file system issues but the storage hardware still appears to function, you may be experiencing partial hardware failure or file system corruption. In these cases, there are some steps you can try using built-in Mac OS X utilities to repair the volumes or at least recover data.
Gathering File System Information
Before attempting any fixes, you should become fully familiar with the file system configuration you’re dealing with. Once again, the /Applications/Utilities/Disk Utility application will be your main tools for gathering file system information. The availability and status of storage hardware in Disk Utility will help determine if you are indeed experiencing hardware failure.
When you open Disk Utility, it will scan the file system for all attached devices and volumes. To gather detailed information about a specific drive or volume in Disk Utility, simply select the item from the column on the left and then click the Info button in the toolbar. Remember, the drive’s name is its size and manufacturer information, whereas a drive’s volumes appear directly below the drive name in the list.
The information gathered from these dialogs will reveal a great deal about the status of a drive or volume. Of most importance for determining hardware failure is a drive’s S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology) status. Drives that feature S.M.A.R.T. technology can automatically determine if the drive is suffering from some sort of internal hardware failure.
If a connected drive doesn’t even appear in the Disk Utility list, odds are the drive has suffered a catastrophic failure. You should double-check the drive’s status using /Applications/Utilities/System Profiler to verify that the drive is unreachable. When you open System Profiler, the drive’s information should appear when you select the bus that the drive is connected to, such as Serial-ATA or FireWire. If a drive does not appear in System Profiler either, then it is not available to the Mac in its current state. At this point you should focus your efforts on troubleshooting the drive hardware. This includes simple fixes, such as looking for loose connections or replacing bad cables, as well as more complex fixes, such as having to replace bad hardware.
Verify or Repair a Volume
Disk Utility can be used to examine and attempt to repair a volume’s directory database. The volume’s directory database is used by the file system to catalog where files and folders exist on the drive. To access data on the drive, the file system must first check with the directory database in order to locate the appropriate bits on the drive that make up the requested file. Obviously, any damage to the volume’s directory database can lead to serious problems, including data loss.
Before any volume is mounted, the Mac will automatically perform a quick consistency check to verify the volume’s directory database. The system will also quickly scan the startup volume during the boot process. However, if the system is unable to mount a volume, you are experiencing issues accessing a volume, or you are booting from the startup disk, you can use Disk Utility to verify and repair a volume’s directory database.
To use Disk Utility’s verify and repair features:
- If you’re attempting to repair the system drive, you should first boot from the Mac OS X Install DVD and then choose Disk
Utility from the Utilities menu.
If you are on a currently running Mac, make sure the drive you wish to verify or repair is currently attached to the computer, then open /Applications/Utilities/Disk Utility.
- Select the drive or volume you wish to verify or repair from the column on the left, and then click the First Aid tab to the right.
- Verify the selected item by clicking the Verify Disk button in the bottom-right corner.
It may take a few minutes to complete the verification process. During this time Disk Utility will show a progress indicator and log entries in the history area. Click the Show details checkbox to view more detail in the history log. You can stop the process at any time by clicking the Stop button.
- If no problems were found, you should see an entry in the history log with green text. If problems were uncovered, they will
appear in bright red text. If the drive has problems, and you haven’t already started the repair process, you should do so
now.
The system will continue to run the repair process until no more problems are found. This may take a while because the system may run through the repair process several times.
Using FireWire Target Disk Mode
Mac hardware has a unique ability to share its internal drives via a feature called FireWire target disk mode. Basically, when FireWire target disk mode is engaged, instead of booting normally from the system disk the Mac will bridge any internal drives to the FireWire ports. Because target disk mode is a function built into the Mac’s hardware, even if the installed operating system volume is corrupted, you can still use this feature. An administrative user can enable FireWire target disk mode on a currently running Mac by clicking the Target Disk Mode button in the Startup Disk preferences. Alternately, you can engage target disk mode during system startup by holding down the T key while you turn on the Mac.
Once target disk mode is engaged, you will see a large FireWire symbol on the screen, and then you can simply plug the targeted Mac into another fully functioning Mac via a FireWire cable. The targeted Mac’s internal volumes should mount normally on the other Mac as if you had plugged in a normal external FireWire-based drive. At this point, you can do anything to the targeted Mac’s internal drive that you could do to any local drive, including installations, repairs, and data migration.
Recovering Data from an Unbootable System
If you are still stuck with a Mac that refuses to fully boot from its internal system drive, you might be able to recover important data off the drive as long as it’s functional. You can use the Mac’s built-in FireWire target disk mode to easily access the internal system drive and recover important data from another fully functional Mac.
To recover data using target disk mode:
- Turn on the troublesome Mac while holding down the T key to engage FireWire target disk mode.
- Once the FireWire symbol appears on the targeted Mac, connect the computer to another fully functioning Mac using a standard FireWire cable.
- If the targeted Mac’s volume appears in the Finder, you should first attempt to repair the volume using Disk Utility, as detailed previously in this chapter.
- Once repairs have been completed, you have a variety of data recovery options:
- Use the Finder to manually copy data from the targeted Mac to storage attached to the functioning Mac.
- Use Disk Utility on the functioning Mac to create a disk image archive of the targeted Mac’s system volume. Creating disk images is covered in Chapter 5, “Data Management and Backup.”
- Use the Migration Assistant on a functioning or newly installed Mac to easily migrate user accounts, settings, or applications. The Migration Assistant is covered in Chapter 1, “Installation and Initial Setup.”
- After you have migrated the data, you should use Disk Utility to reformat the targeted Mac’s drive and then attempt to reinstall
the operating system.
System installation is also covered in Chapter 1, “Installation and Initial Setup.”
Depending on the amount of corruption present on the targeted Mac’s system drive, you may not be able to use Disk Utility or the Migration Assistant. The drive may simply be too corrupted to recover all that data. In this case, you will have to resort to manually copying data.
In general, the most important items to users are stored in their home folder, so you should start there. This can be a time-consuming process; as the Finder discovers damaged files, you will have to manually restart the copy process and omit the damaged files.
Permissions Troubleshooting
Permissions issues can be caused from a variety of situations. Many issues are due to user error, but others can be the result of an unintentional failure elsewhere in the system. For instance, some software installers may improperly change permissions during the installation process. You may also experience permissions issues after restarting from a power loss or system freeze.
System and application errors, such as applications that will not open or an inability to empty the Trash, may occur due to incorrect permissions. Many of these permissions issues can be resolved by utilities that are part of Mac OS X. If you are having trouble accessing an application, you should attempt to resolve the issue using Disk Utility’s Repair Disk Permissions feature. Also, if you are experiencing problems trying to access home folders, you can use the Reset Password utility on the Mac OS X Installer DVD to reset home folder permissions. The use of these two utilities for resolving permissions issues is covered later in this section.
Most general permissions issues are revealed in obvious ways. A user attempting to access a file or folder is immediately stopped and presented with a dialog stating that he doesn’t have the appropriate permissions. In this case, a permissions change on the item, or the folder it’s inside of, is usually all that’s needed to resolve the issue. If you are going to attempt to repair the item’s permissions manually, you should be familiar with the methods for managing permissions outlined previously in this chapter.
Clearing ACLs via Command Line
Compared with adjusting traditional UNIX-style permissions, adjusting file and folder ACLs is quite complicated—in fact, such detailed ACL management goes beyond the scope of this guide. Nevertheless, there is one helpful trick for resolving access issues if you think improperly set ACLs are causing the issue. You can, with a single command, clear all the ACLs for a given file or folder using the chmod command with the –N option.
In the following example, Michelle needs to clear the troublesome ACLs of a shared folder named “SharedStuff” and its contents. She first lists the permissions with ACLs using the ls command. Then uses chmod -N to “clear” the folder’s ACLs. Finally, Michelle double-checks her work by viewing the permissions again, verifying that the ACL is empty for the SharedStuff folder.
MyMac:Shared michelle$ls -le
total 0 drwxr-xr-x+ 2 cadmin wheel 68 Jul 7 22:37 SharedStuff 0: group:family allow add_file,search,add_subdirectory,delete_child,readattr,writeat tr,writeextattr,readsecurity MyMac:Shared michelle$sudo chmod -N SharedStuff/
Password: MyMac:Shared michelle$ls -le
total 0 drwxr-xr-x 2 cadmin wheel 68 Jul 7 22:37 SharedStuff
Disk Utility’s Repair Permissions
One of the most common troubleshooting techniques for Mac OS X is to use Disk Utility’s Repair Disk Permissions feature. Many novice Mac administrators use this technique every time they encounter any problem. The reality is that this process fixes only file permissions issues specific to certain installed Apple software. Further, this process will not touch any incorrect permission settings on personal or user data.
In other words, this process, though a good starting point for addressing system and application issues, will not fix every incorrect permissions issue on a problematic Mac. In fact, you can verify exactly which installed items the repair permissions process will fix from the repair_packages command. In the following example Michelle uses this command to list the packages that will be checked. Note that the output was truncated to save space.
MyMac:~ michelle$ sudo /usr/libexec/repair_packages --list-standard-pkgs
Password:
com.apple.pkg.ServerAdminTools
com.apple.pkg.ServerSetup
com.apple.pkg.Rosetta
com.apple.pkg.X11User
...
The upside is that the repair permissions process is an easy troubleshooting step that could resolve many permissions issues. Keep in mind that many default folders were also installed as part of the operating system. Thus, the repair permissions process will not only repair system items, but also important folders like /Applications and /Library.
To verify or repair disk permissions:
- Open Disk Utility on a currently running Mac by opening /Applications/Utilities/Disk Utility, or on a Mac booted from the Mac OS X Install DVD by choosing Disk Utility from the Utilities menu.
- Select the system volume you wish to repair from the column on the left.
- Select the First Aid tab to the right.
- Click the Verify Disk Permissions button to view a log of any potential problems.
- Click the Repair Disk Permissions button to view and fix any permission problems.
Reset Password’s Reset Home Permissions
If a user’s home folder becomes inaccessible due to improper permissions, you can attempt to fix the issue by manually adjusting the permissions yourself, or you can try the Reset Password utility found only on the Mac OS X Install DVD. This utility was primarily designed to reset user passwords; nonetheless, this tool also has the ability to reset a user’s home folder permissions and ACLs. Keep in mind that this process will reset all home folder permissions, including intentionally changed permissions that may have benefited the user.
To reset home folder permissions and ACLs:
- Start up the Mac from the Mac OS X Install DVD by turning on the computer while holding down the C key, and as soon as possible, insert the installation disc and the computer will start from it.
- Once the installer has started, choose Utilities > Reset Password from the menu bar.
- Select the system volume containing the home folder you wish to reset from the row of system volume icons.
- Choose the user account whose home folder needs resetting from the user pop-up menu.
- Click the Reset button at the bottom to reset this user’s home folder permissions and ACLs.
- Quit the Reset Password utility to return to the Mac OS X Installer. Then quit the Mac OS X Installer to restart the Mac.