Mac OS X: About file system journaling
Journaling is a feature that helps protect the file system against power outages or hardware component failures, reducing the need for directory repairs. 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.
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.
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.
Practical usage and further information
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:
Open Disk Utility (located in Applications/Utilities).
Select the volume to enable or disable journaling on.
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.
Learn more
Journaling was first introduced in Mac OS X Server v10.2.2, then to the non-server OS in Mac OS X v10.3 Panther.