Corruption can also occur on most modern disks due to in-disk re-ordering.
Modern disks typically do re-ordering of requests that are used to speed up performance (by re-ordering writes to make the entire list of requests less seeky), this is called Tagged Command Queueing.
It is possible the write to the journal on the disk is delayed because its more efficient from the head position currently to write in a different order to the one the operating system requested as the actual order, meaning blocks can be committed before the journal is.
The way to resolve this is to make the operating system explicitly wait for the journal to have been committed before committing any more writes. This is known as a barrier. Most filesystems do not use this by default and would explicitly need enabling with a mount option.
mount -o barrier=1 /dev/sda /mntpnt
The big downside to barriers is they have a tendency to slow I/O down, sometimes dramatically (around 30%) which is why they arent enabled by default. In addition to this, things become doubleplusungood when you start to add logical layering on top of standard disks like LVM or Raid. LVM (relatively recently) added barrier support for most LV configurations and mdadm seems to have had it for a little while.
http://serverfault.com/questions/403891/journaled-filesystems-and-power-failure
磁盘重排序与文件系统屏障
本文探讨了现代磁盘中的重排序机制如何影响数据的一致性,并可能导致数据损坏。特别是介绍了Tagged Command Queueing如何通过改变写入顺序来提高性能,以及这可能带来的问题。文章还详细讨论了解决方案——文件系统的屏障机制,即在提交其他写操作前确保日志已写入磁盘。
5306

被折叠的 条评论
为什么被折叠?



