UFS logging bundles the multiple metadata changes that comprise a complete UFS operation into a transaction. Sets of transactions are recorded in an on-disk log. Then, they are applied to the actual UFS file system's metadata.
At reboot, the system discards incomplete transactions, but applies the transactions for completed operations. The file system remains consistent because only completed transactions are ever applied. This consistency remains even when a system crashes. A system crash might interrupt system calls and introduces inconsistencies into a UFS file system.
UFS logging provides two advantages:
If the file system is already consistent due to the transaction log, you might not have to run the fsck command after a system crash or an unclean shutdown. For more information on unclean shutdowns, see What the fsck Command Checks and Tries to Repair.
The performance of UFS logging improves or exceeds the level of performance of non logging file systems. This improvement can occur because a file system with logging enabled converts multiple updates to the same data into single updates. Thus, reducing the number of overhead disk operations required.
Logging is enabled by default for all UFS file systems, except under the following conditions:
When logging is explicitly disabled.
If there is insufficient file system space for the log.
In previous Solaris releases, you had to manually enable UFS logging.
Keep the following issues in mind when using UFS logging:
Ensure that you have enough disk space for your general system needs, such as for users and applications, and for UFS logging.
If you don't have enough disk space for logging data, a message similar to the following is displayed:
# mount /dev/dsk/c0t4d0s0 /mnt /mnt: No space left on device Could not enable logging for /mnt on /dev/dsk/c0t4d0s0. # |
However, the file system is still mounted. For example:
# df -h /mnt Filesystem size used avail capacity Mounted on /dev/dsk/c0t4d0s0 142M 142M 0K 100% /mnt # |
A UFS file system with logging enabled that is generally empty will have some disk space consumed for the log.
If you upgrade to this Solaris release from a previous Solaris release, your UFS file systems will have logging enabled, even if the logging option was not specified in the /etc/vfstab file. To disable logging, add the nologging option to the UFS file system entries in the /etc/vfstab file.
The UFS transaction log has the following characteristics:
Is allocated from free blocks on the file system
Sized at approximately 1 MB per 1 GB of file system space, up to 256 MB. The log size might be larger, up to a maximum of 512 MB, if the file system has a large number of cylinder groups.
Continually flushed as it fills up
Also flushed when the file system is unmounted or as a result of any lockfs command.
If you need to enable UFS logging, specify the -o logging option with the mount command in the /etc/vfstab file or when you manually mount the file system. Logging can be enabled on any UFS file system, including the root (/) file system. Also, the fsdb command has new debugging commands to support UFS logging.
In some operating systems, a file system with logging enabled is known as a journaling file system.