Installation guide

Chapter 17. Write Barriers
106
cached. However, because the cache's volatility is not visible to the kernel, Red Hat Enterprise Linux 6
enables write barriers by default on all supported journaling file systems.
Note
Write caches are designed to increase I/O performance. However, enabling write barriers means
constantly flushing these caches, which can significantly reduce performance.
For devices with non-volatile, battery-backed write caches and those with write-caching disabled, you
can safely disable write barriers at mount time using the -o nobarrier option for mount. However,
some devices do not support write barriers; such devices will log an error message to /var/log/
messages (refer to Table 17.1, “Write barrier error messages per file system”).
Table 17.1. Write barrier error messages per file system
File System Error Message
ext3/ext4 JBD: barrier-based sync failed on
device - disabling barriers
XFS Filesystem device - Disabling
barriers, trial barrier write failed
btrfs btrfs: disabling barriers on dev
device
17.3. Write Barrier Considerations
Some system configurations do not need write barriers to protect data. In most cases, other methods
are preferable to write barriers, since enabling write barriers causes a significant performance penalty.
Disabling Write Caches
One way to alternatively avoid data integrity issues is to ensure that no write caches lose data on
power failures. When possible, the best way to configure this is to simply disable the write cache. On
a simple server or desktop with one or more SATA drives (off a local SATA controller Intel AHCI part),
you can disable the write cache on the target SATA drives with the hdparm command, as in:
hdparm -W0 /device/
Battery-Backed Write Caches
Write barriers are also unnecessary whenever the system uses hardware RAID controllers with
battery-backed write cache. If the system is equipped with such controllers and if its component drives
have write caches disabled, the controller will advertise itself as a write-through cache; this will inform
the kernel that the write cache data will survive a power loss.
Most controllers use vendor-specific tools to query and manipulate target drives. For example, the
LSI Megaraid SAS controller uses a battery-backed write cache; this type of controller requires the
MegaCli64 tool to manage target drives. To show the state of all back-end drives for LSI Megaraid
SAS, use:
MegaCli64 -LDGetProp -DskCache -LAll -aALL
To disable the write cache of all back-end drives for LSI Megaraid SAS, use: