# "EXT3-fs: barriers not enabled" with barrier=1 ?

## svenc

Hi.  I'm trying to confirm that ext3 write barriers are enabled despite the kernel ring buffer saying otherwise:

```
EXT3-fs (dm-0): using internal journal

usb 5-2.1: new full speed USB device using uhci_hcd and address 5

EXT3-fs: barriers not enabled

```

cat /proc/mounts reveals:

```

/dev/vg0/root / ext3 rw,relatime,errors=continue,user_xattr,commit=5,barrier=1,data=ordered 0 0
```

Does output of /proc/mounts confirm it is enabled ?

Thank you.  Sven

----------

## pigeon768

No, /proc/mounts just displays what options were used to mount the FS; if the underlying device does not support barriers, barriers will be disabled at a later time.

Are you using LVM? LVM1 or LVM2? What kernel are you using? What configuration is the underlying devices? Barriers are supported by LVM2 since 2.6.33.

----------

## svenc

Hi pigeon768, that is good to know about /proc/mounts, thank you.

"equery uses lvm2":

```
[ Found these USE variables for sys-fs/lvm2-2.02.73-r1 ]

 U I

 - - clvm     : Allow users to build clustered lvm2

 - - cman     : Cman support for clustered lvm

 - + lvm1     : Allow users to build lvm2 with lvm1 support

 + + readline : Enables support for libreadline, a GNU line-editing library that almost everyone wants

 - - selinux  : !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur

 - - static   : !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically

```

"uname -r":

```
2.6.36-gentoo-r5
```

This root partition is using RAID1 and LVM2.  To boot I use an initramfs embedded within kernel.  The static binary of LVM2 I compiled for initramfs should not prevent write barriers? Init from initramfs below:

```
#!/bin/busybox sh

echo "****this kernel has bzip2 initramfs located at /usr/src/initramfs****"

echo "****to modify simple edit directory contents and recompile kernel****"

rescue_shell() {

    echo "Something went wrong. Dropping you to a shell."

    busybox --install -s

    exec /bin/sh

}

# Mount the filesystems

mount -t proc           none /proc

mount -t sysfs          none /sys

mount -t devtmpfs       none /dev

# assemble raid devices within mdadm.conf

mdadm --assemble --scan

# scan disks for vg and rebuild caches, create missing nodes /dev

# following command results "md0: unknown partition table"

lvm.static vgscan --mknodes

# make logical volumes available

lvm.static lvchange -ay vg0/root

# Mount the root filesystem, could ask for input as to which device to mount?

mount -o ro /dev/vg0/root /mnt/root || rescue_shell

# Clean up

umount /proc

umount /sys

umount /dev

# Boot the real thing

exec switch_root /mnt/root /sbin/init

```

some kernel ring buffer info related to drives:

```
ata_piix 0000:00:1f.2: MAP [ P0 -- P1 -- ]

ata_piix 0000:00:1f.2: setting latency timer to 64

scsi0 : ata_piix

scsi1 : ata_piix

ata1: SATA max UDMA/133 cmd 0x1f0 ctl 0x3f6 bmdma 0xf000 irq 14

ata2: SATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xf008 irq 15

ata1.00: ATA-8: WDC WD1001FALS-00J7B1, 05.00K05, max UDMA/133

ata1.00: 1953525168 sectors, multi 16: LBA48 NCQ (depth 0/32)

ata2.00: ATA-8: WDC WD1001FALS-00U9B0, 05.00K05, max UDMA/133

ata2.00: 1953525168 sectors, multi 16: LBA48 NCQ (depth 0/32)

ata2.00: configured for UDMA/133

ata1.00: configured for UDMA/133

scsi 0:0:0:0: Direct-Access     ATA      WDC WD1001FALS-0 05.0 PQ: 0 ANSI: 5

sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00

sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

sd 0:0:0:0: Attached scsi generic sg0 type 0

scsi 1:0:0:0: Direct-Access     ATA      WDC WD1001FALS-0 05.0 PQ: 0 ANSI: 5

sd 1:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)

sd 1:0:0:0: [sdb] Write Protect is off

sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00

sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

sd 1:0:0:0: Attached scsi generic sg1 type 0

 sdb: sdb1 sdb2

sd 1:0:0:0: [sdb] Attached SCSI disk

 sda: sda1 sda2

sd 0:0:0:0: [sda] Attached SCSI disk
```

Sven

----------

## pigeon768

I'm at a loss. Your setup ought to work with barriers. Maybe there's a problem with lvm on top of mdraid.

Complete shot in the dark, but you might try using AHCI mode instead of IDE mode. (in the bios, you'll also have to make sure the ahci driver is installed.)

I'm afraid I'm at the limit of my knowledge.

----------

## svenc

 *Quote:*   

> but you might try using AHCI mode instead of IDE mode. (in the bios, you'll also have to make sure the ahci driver is installed.)

 

This vintage motherboard has ICH5 which is pre-ACHI according to documents on the Internet.

More digging in Documentation/block/barrier.txt:

 *Quote:*   

> ii. For devices which have queue depth greater than 1 but don't
> 
> support ordered tags, block layer ensures that the requests preceding
> 
> a barrier request finishes before issuing the barrier request.  Also,
> ...

 

I think this means that if the SATA device driver ( i.e. ata_piix for ICH5 ) doesn't support "ordered tags", then barrier write is disabled.  The motherboard also has sil 3112 sata controllers, but it would seem to have the same limitation.

In the process of realizing this I also found:

http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/writebarrierconsider.html which says:

 *Quote:*   

> 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/ 

 

since write cache was enabled by default on these drives, this would seem important.

So, in the end, ext3 with data=ordered on raid1 with write cache disabled for raid devices.  I think this is safe combination, but welcome input from others.

Thanks for the answering pigeon768!

Sven

----------

