Journaling is a Mac OS X feature that is extremely helpful in protecting the system against the problems that arises due to power failures, hardware failures and directory corruptions. When the journaling is enabled on Mac, it keeps record entries of the changes to the files present on the disk. These entries are maintained in a special type of data structure called “Journal”. All of this happens automatically on OS X. In an event of an abrupt shutdown of the system due to power outage or another failure, these journal entries make it possible to restore the system to the last known consistent state of working. However, the data that was in the buffer while the system failed, may be lost but the system is reinstated to the working state. Additionally, restarting the system gets faster due to journaling. If the drive is formatted in Mac OS X Extended (Journaled), then by default, journaling is active on the drive. Manually activating and deactivating the journaling feature is discussed later in this article.
Importance of journaling on a Mac system
With every write and read operations, file system directories are updated with the file locations and other data. Before the operating system commits to any action, it makes an entry in the “Journal” and then executes the transaction. Additionally, it also marks the action as completed in the journal once the task has been executed. This way a record is maintained of the current transactions, that happen. However, this process results in write overheads; it is worth it. In an event of a power failure or any other disaster which prevents this update to the file system directories, the operating system will take an unexpected amount of time to start again since the system will have to perform a consistency check that requires it to go through the entire file system block by block. More the data present on the system, more time it takes to reinstate the machine to its working state. With journaling feature enabled, a lot of time spent on consistency check can be saved, as with journaling is done already, the need for consistency check is eliminated. All that operating system has to do is to refer to the “Journal” and get the records of all recent transactions that happened prior to the system failure. This way the system is reinstated to the working state faster. In addition, it just takes a few seconds for the operating system to resume the normal operations.
Additionally, the journaling feature on Mac OS extended filesystem being implemented in an incremental way; it is backward compatible with Mac OS extended filesystem machines not having this feature. This means that you can read, write or access the Journaled Mac OS extended volumes on a machine with Mac OS extended file system that does not have a journaling feature.
Turning ON/OFF the journaling feature on a Mac
Turning on the journaling feature is quite simple and can be done from Disk Utility application on a Mac. Here’s how to do it:
- Go to Applications > Disk Utility
- Select the volume or drive on which journaling is to be enabled. If the volume is formatted with Mac OS Extended (Journaled), journaling is already active.
- Select the File menu option
- From the dropdown list, select Enable journaling. This enables the journaling on the selected volume
Alternatively, you can also enable it using the Terminal application. Here’s how to do it:
- Go to Terminal application
- Enter the command sudo diskutil enableJournal volume/VOLUME_NAME and press return
Journaling on the Mac hard drive is enabled by default. It does incur write overheads as the file system makes an entry in the journal before committing the transaction and later has to mark it as complete in the journal. These write overheads are worth since journaling provides protection against system failures. However, in some cases, journaling may have to be turned off due to reasons such as a media device not supporting HFS+ Journaled or some programming files that works best without journaling to gain more operating speed. In such cases, here’s how to turn off journaling:
- Go to Terminal application
- Enter the command sudo diskutil disableJournal volumes/VOLUME_NAME and press return
Some older versions of OS X prior to OS X Mountain Lion allows disabling journaling from disk utility itself. Just select the volume and disable journaling from the File menu.