Bruno Wolff III
2006-Dec-09 22:04 UTC
fsync, ext3, raid (md) 1, write barriers and PATA caching
I have been trying to figure out whether I can enable write caching on my PATA hard drives (WD3200JB) and have fsync not return until data is safely on the platters. I am also running software raid. This is currently on FC5 (though soon to be FC6) with a 2.6.18 kernel.>From snippets I have found on the net, it looks like write barriers arepushed down through software raid when using raid 1. So that if I mount the file systems with data=ordered and barrier=1, I think I should be OK, but I was hoping to get a more definitive answer. It also looks like barrier=1 is or will be the default for ext3. Is there a way I can check if this is the case on my system? /proc/mounts doesn't show the barrier option when I use barrier=1 or don't specify it at all. mount -lv shows the barrier option (when it was used for mounting), but not the data option. I am not sure if either of these are using the same data that the ext3 driver is using.
Christian Kujau
2006-Dec-09 22:51 UTC
fsync, ext3, raid (md) 1, write barriers and PATA caching
On Sat, 9 Dec 2006, Bruno Wolff III wrote:> It also looks like barrier=1 is or will be the default for ext3. Is there > a way I can check if this is the case on my system?Hm, indeed: if write barriers are not available, mounting an XFS filesystem shows:> Filesystem "md0": Disabling barriers, not supported by the underlying deviceMounting the same device when formatted with ext3 does not show this message nor does /proc/mounts reveal anything....could this be tweaked somehow? Christian. -- BOFH excuse #288: Hard drive sleeping. Let it wake up on it's own...
Ric Wheeler
2006-Dec-11 16:14 UTC
fsync, ext3, raid (md) 1, write barriers and PATA caching
Bruno Wolff III wrote:> I have been trying to figure out whether I can enable write caching on my > PATA hard drives (WD3200JB) and have fsync not return until data is > safely on the platters. I am also running software raid. > This is currently on FC5 (though soon to be FC6) with a 2.6.18 kernel. > >>From snippets I have found on the net, it looks like write barriers are > pushed down through software raid when using raid 1. So that if I mount > the file systems with data=ordered and barrier=1, I think I should be > OK, but I was hoping to get a more definitive answer. > > It also looks like barrier=1 is or will be the default for ext3. Is there > a way I can check if this is the case on my system? > > /proc/mounts doesn't show the barrier option when I use barrier=1 or don't > specify it at all. mount -lv shows the barrier option (when it was used > for mounting), but not the data option. I am not sure if either of these > are using the same data that the ext3 driver is using.You can always do a sanity test on the barrier by timing how many synchronous files/sec you can create (i.e., create/write/fsync/close). Speeds vary depending on what kind of drive you have, journal mode, etc, but you will always see much faster times with the barrier off than on while writing small files (say 10K). regards, ric