Questions tagged [write-barrier]

A *write barrier* is a kernel mechanism used to ensure that file system metadata is correctly written and ordered on persistent storage, even when storage devices with volatile write caches lose power.

File systems take great care to safely update metadata, ensuring consistency. Journalled file systems bundle metadata updates into transactions and send them to persistent storage in the following manner:

  1. First, the file system sends the body of the transaction to the storage device.
  2. Then, the file system sends a commit block.
  3. If the transaction and its corresponding commit block are written to disk, the file system assumes that the transaction will survive any power failure.

However, file system integrity during power failure becomes more complex for storage devices with extra caches. Storage target devices like local S-ATA or SAS drives may have write caches ranging from 32MB to 64MB in size (with modern drives). Hardware RAID controllers often contain internal write caches. Further, high end arrays, like those from NetApp, IBM, Hitachi and EMC (among others), also have large caches.

Storage devices with write caches report I/O as "complete" when the data is in cache; if the cache loses power, it loses its data as well. Worse, as the cache de-stages to persistent storage, it may change the original metadata ordering. When this occurs, the commit block may be present on disk without having the complete, associated transaction in place. As a result, the journal may replay these uninitialized transaction blocks into the file system during post-power-loss recovery; this will cause data inconsistency and corruption.

(Source and attribution: Red Hat Storage Administration Guide CC BY-SA)

2 questions
14
votes
2 answers

Should we mount with data=writeback and barrier=0 on ext3?

We've been running a server on a VM at a hosting company, and have just signed up for a dedicated host (AMD Opteron 3250, 4 cores, 8GB RAM, 2 x 1TB in software RAID, ext3). While running performance tests, we noticed that some SQLite transations…
NeilB
  • 243
  • 1
  • 2
  • 9
4
votes
0 answers

How to disable write barrier on docker thinpooldev?

My server has very low disk performance if write barrier is enabled. As it has a disk controller with battery for the cache it is safe to add the "nobarrier" option to /etc/fstab. This makes a huge difference in performance. I want to the same for…
Peter
  • 849
  • 8
  • 10