"Journaling" is a feature that helps protect the file system against power outages or hardware component failures, reducing the need for repairs. Journaling was first introduced in Mac OS X Server 10.2.2, then to the non-server OS in Mac OS X 10.3 Panther. This document explains some of the benefits of using this feature and how it works.
Journaling for the Mac OS Extended (HFS Plus) file system enhances computer availability and fault resilience, which is especially noteworthy for servers. Journaling protects the integrity of the file system on Xserve and other computers using Mac OS X Server in the event of an unplanned shutdown or power failure. It also helps to maximize the uptime of servers and connected storage devices by expediting repairs to the affected volumes when the system restarts.
Journaling is a technique that helps protect the integrity of the Mac OS Extended file systems on Mac OS X volumes. It both prevents a disk from getting into an inconsistent state and expedites disk repair if the server fails.
When you enable journaling on a disk, a continuous record of changes to files on the disk is maintained in the journal. If your computer stops because of a power failure or some other issue, the journal is used to restore the disk to a known-good state when the server restarts.
With journaling turned on, the file system logs transactions as they occur. If the server fails in the middle of an operation, the file system can "replay" the information in its log and complete the operation when the server restarts.
Although you may experience loss of user data that was buffered at the time of the failure, the file system is returned to a consistent state. In addition, restarting the computer is much faster. Always remember to back up your data as frequently as necessary.
Why is journaling needed?
A power outage or system failure interrupts read and write processes, which can cause discrepancies between the file system directory and the actual location and structure of stored files. In an unjournaled file system, drives are in an unknown state after a failure, meaning that there is no record of their activity just prior to the shutdown. Before the server can restart and resume services, it must perform a consistency check that requires going through the entire file system, block by block. This process can take hours on a multi-terabyte volume, resulting in an unacceptable period of server downtime.
Journaling accelerates the recovery time after an unexpected shutdown, significantly improving the availability of server and storage systems. When journaling is turned on on a storage volume, the server automatically tracks file system operations and maintains a continuous record of these transactions in a separate file, called a journal. The operating system can use the journal to return the file system to a known, consistent state after a failure. This eliminates the need to perform a consistency check on the entire file system during startup. Instead, when the server is restarted, Mac OS X simply replays recent transactions in the journal, bringing the system up-to-date and resuming operations that were interrupted during the failure. With a journaled file system, server restart takes just a few seconds, regardless of the number of files, or the size of the volume.
Backward Compatible
Journaled file system is part of a set of incremental enhancements to the Mac OS Extended file system, and it is backward compatible with the Mac OS Extended file system. Users can read, write, and access journaled Mac OS Extended volumes on computers that do not have a journaling feature.
Most disk utilities designed to work with the Mac OS Extended file system can also be used when journaling is turned on. You should check with your disk utility vendor before using earlier disk utilities with a journaled file system.
When Should Journaling Be Used?
Journaling is best suited for servers requiring high availability, servers containing volumes with many files, and servers containing data that is backed up at infrequent intervals (nightly, for example).
If a volume contains read-only data that is not mission-critical, it may not be necessary to turn on journaling if performance is more important than safety.
If your server contains high-bandwidth usage data files, such as large video, graphics, or audio files, you may want to weigh the benefits of using journaling against the performance needed to access your data. In most cases, the impact of journaling upon data access performance are unnoticeable to users, but its implementation may not be practical for servers where data access demands outweigh its benefits.
Practical Usage and Further Information
You can turn journaling on and off for disks on the server you are logged into by using Disk Utility or command line tools, with or without erasing the volume. For instructions, see "Mac OS X Server 10.2: How to Enable/Disable Journaling or Repair a Journaled Volume".
You may see certain harmless "error" messages when journaling is turned on. To learn about these, see "Mac OS X: fsck Reports Benign Error Messages When Journaling is Active".
To turn journaling on and off using Disk Utility:
1. Open Disk Utility (located in Applications/Utilities).
2. Select the volume to enable or disable journaling on.
3. To enable, click the Enable Journaling button or choose Enable Journaling from the File menu.
To disable journaling, choose Disable Journaling from the File menu.
Note: In Mac OS X 10.4 and later, press Option to make Disable Journaling visible in the File menu.