Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

closed as unclear what you're asking by Dennis Kaarsemaker, mdpc, Ward, Falcon Momot, kce Aug 6 '13 at 16:26

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
And the question is? –  Dennis Kaarsemaker Aug 5 '13 at 19:08
    
Is the cache battery-backed? If not, there's your reason. –  Nathan C Aug 5 '13 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 '13 at 19:27
    
cache has battery. Also occurs in write through mode. 2nd system does not have controller with disk cache disabled. –  Sean Leighton Aug 5 '13 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. –  Sean Leighton Aug 5 '13 at 19:45
show 4 more comments

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.