0

Files written within a minute of a power failure are zero bytes when the system comes back. Testing for a system that we can not guarantee will have ups backup.

Centos 6.4
kernel 2.6.32-358.14.1.el6.x86_64
ext4 mounted with defaults

See this occurring on 2 different systems (the only two that I have tried it on)

1st with PERC h710 controller RAID 6 with 4 3TB drives.
It happens with and without lvm
It happens in both write through and write back cache.

2nd with no RAID controller 2TB disk
only tested without lvm

Suggestions on how to prevent this?

9
  • 2
    And the question is? Aug 5, 2013 at 19:08
  • Is the cache battery-backed? If not, there's your reason.
    – Nathan C
    Aug 5, 2013 at 19:26
  • Why RAID 6 with 4 drives? Is your goal to extend the array later? (Most people seem to go for RAID 10 when using four drives.)
    – Hennes
    Aug 5, 2013 at 19:27
  • cache has battery. Also occurs in write through mode. 2nd system does not have controller with disk cache disabled. Aug 5, 2013 at 19:27
  • raid 10 can still lose data when 2 drives fail. raid 6 should be able to recover no matter which 2 drives fail. Aug 5, 2013 at 19:45

1 Answer 1

1

Going by your description, this sounds like the OS hasn't flushed your data to disk, given that you do have the file-metadata, just without any content/length.

write(2) doesn't by any means guarantee that your data have hit disk (unless you open(2) your files with O_DIRECT), you're at the behest of the OS/filesystem and when it decides to flush data/metadata to disk. In order to guarantee that your data is safely tucked away, you have two options:

The big caveat in this is caches (which may or may not) be battery backed on both the drives and the raid-controllers, notably there are some drives which will put your writes on their internal ram cache and state they've written it, in which there exists some window of time where a power-loss would make you loose data.

Not the answer you're looking for? Browse other questions tagged .