Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running a file server using Linux software raid, set up as raid6. As filesystem I've chosen btrfs. However, I'm not using btrfs own raid6 implementation as it's not very stable yet. So basically, I'm using raid on the block level of things. Additionally, I'm making backups to another location of really important data. Lastly, I've connected a UPS to the server to protect against power loss and surges.

My questions:

  1. I'm aware raid6 gives quite a good protection against harddrive failure, but will btrfs on top of it really detect bit rot and correct it? If so, how is that possible without filesystem raid1?

  2. Do md go through the raid6 block from time to time to find and correct corruptions? Do I need to schedule it?

  3. If I've done things wrong, what do you recommend I do instead, if I want good protection against data failure and bit rot?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

1: In your configuration, btrfs should detect data corruption but won't correct it as there is no data redundancy as far as btrfs is concerned.

2: RAID6 doesn't detect nor reliably protect against bit corruption. It only protects against disk failure and in some cases might detect unused still bad blocks.

3: If btrfs RAID6 is not ready, you might consider either btrfs mirroring or ZFS RAIDZ2.

share|improve this answer
(Answering a question that disappeared: will RAIDZ6 protect against bit-rot) Yes, it does it by design. There is still a risk of corruption due to RAM bit-flip. End-to-end data integrity requires ECC RAM and is recommended at least for production systems. By the way, that's RAIDZ2, not RAIDZ6. – jlliagre Jun 16 '14 at 20:13

In your setup it would not.

What I would recommend is using ZFS built-in RAID-z2, which is then able to perform bit-rot recovery. Enabling lz4 compression will also provide better performance, as well as space savings.

share|improve this answer

BTRFS RAID-6 is (though still experimental) actually pretty stable now. The current version even manages to fix many typical errors, including replacing a failed/missing drive.

Like ZFS, BTRFS does checksumming, which means that you can always (and you should, periodically) run a scrub to verify your data. If data (data or metadata) on a drive is damaged, BTRFS will be able to detect the errors and if it has redundancy (using BTRFS RAID-6), it can fix the affected files. After this, it will know if the repaired files are correct because it has checksums.

Classic (hardware) RAID systems, including MD (software) RAID, do not have checksums. Those systems rely on parity only, so an unfortunate combination of errors on several drives could very well lead to corruption. Since there are no checksums, the RAID system (like md) won't be able to verify that all errors are gone after a scrub (i.e., that the files are correct). There are examples (also some videos) that demonstrate data corruption on a classic RAID system.
It's important to be notified as soon as the first parity error is detected and fix the issue as soon as possible (scrub). Also, since the parity is the only (not very reliable) way for the RAID system to know if your data is ok or not, battery backups should be used to prevent losing all this valuable parity data to the write hole when the power goes out.

Now, if you use an advanced filesystem like BTRFS that does checksumming as a single filesystem (without redundancy) on top of a dumb RAID-6 system, it's up to this RAID system to detect and fix errors because once too many errors have corrupted the RAID system, BTRFS will NOT be able to fix them. It will detect errors and it will help you decide what to restore from your backup by telling you which files (path) are corrupt. But otherwise, it would be too late by then. This is why this setup might not be such a good idea after all.

If you use BTRFS the way it's supposed to be used, by creating a BTRFS RAID-6 filesystem (without MD RAID) with direct access to your drives, it will be able to fix errors reliably and it will know if the errors are actually gone because it has checksums. It will tell you on which drives these errors occurred, so you know which drive is bad (you can replace it using btrfs commands). The point is, no matter if a drive is dead/missing and you have to replace it or if a drive is partially corrupted (because it's about to die), BTRFS will detect the errors reliably. Of course, periodic scrubs are as important as with other RAID systems, to detect silent corruption (hint: cronjob).

So again, BTRFS RAID-6 is still considered experimental in some ways, but by having checksums it already offers a reliable way to detect (and then fix) errors. It's experimental, so it could crash in certain cases, then you should try a newer kernel version, which is the fix for many BTRFS issues. Make sure to stay up to date with your kernel (4.3 at the time of writing, don't use anything older than that for RAID-6). But typical RAID use cases (just storing lots of data and at some point replacing a drive - a multi-drive failure might be different) already work with BTRFS.

You've tagged your question with . ZFS isn't included in the Linux kernel, so it would have to be installed manually - the ZFSonLinux port works very well. It might be necessary to reinstall it or do some other fixing after a new kernel version has been installed, but that's not important now. Of course, there are some things that work differently in ZFS. Also, unlike a BTRFS filesystem, a ZFS RAIDZ2 (like RAID-6) zpool cannot be resized (there are "tricks", but bottom line is that a raidz2 vdev cannot really be grown by adding a drive), so an existing system cannot easily be expanded with more drives. However, as far as stability is concerned, ZFS is probably the best choice of all. With checksums, it offers reliable data protection as described and it's mature enough to handle pretty much everything (multiple drive failures, shaky controller, ZFS survives almost everything and can protect/fix your data as long as you have enough good drives). Given that (like BTRFS) ZFS needs to access your drives individually (to be able to fix errors), you definitely should not use it on top of an MD RAID volume unless you have a good reason for it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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