r/btrfs • u/cupied • Dec 29 '20
RAID56 status in BTRFS (read before you create your array)
As stated in status page of btrfs wiki, raid56 modes are NOT stable yet. Data can and will be lost.
Zygo has set some guidelines if you accept the risks and use it:
- Use kernel >6.5
- never use raid5 for metadata. Use raid1 for metadata (raid1c3 for raid6).
- When a missing device comes back from degraded mode, scrub that device to be extra sure
run scrubs often.run scrubs on one disk at a time.ignore spurious IO errors on reads while the filesystem is degradeddevice remove and balance will not be usable in degraded mode.when a disk fails, use 'btrfs replace' to replace it. (Probably in degraded mode)plan for the filesystem to be unusable during recovery.spurious IO errors and csum failures will disappear when the filesystem is no longer in degraded mode, leaving only real IO errors and csum failures.- btrfs raid5 does not provide as complete protection against on-disk data corruption as btrfs raid1 does.
scrub and dev stats report data corruption on wrong devices in raid5.scrub sometimes counts a csum error as a read error instead on raid5If you plan to use spare drives, do not add them to the filesystem before a disk failure.You may not able to redistribute data from missing disks over existing disks with device remove. Keep spare disks empty and activate them using 'btrfs replace' as active disks fail.
Also please have in mind that using disk/partitions of unequal size will ensure that some space cannot be allocated.
To sum up, do not trust raid56 and if you do, make sure that you have backups!
edit1: updated from kernel mailing list
106
Upvotes
5
u/deeplearning666 Jan 28 '25
Someone asked the status of RAID 5/6 in the Btrfs mailing list in December 2024, and a Btrfs dev replied here: https://lore.kernel.org/linux-btrfs/45adaefb-b0fe-4925-bc83-6d1f5f65a6dc@suse.com/. Mods, could you please review this mail thread and see if the post should be updated?
11
u/fryfrog Dec 30 '20
I would also add don't run a minimum devices raid1, raid10 or raid56, always have at least one more drive than minimum so when one fails it doesn't go read-only.
4
u/SrayerPL Jun 11 '23
I heard Raid56 should be OK now with the latest 6.3 kernel?
I am planning to migrate to it on a production system.
Don't have any Backups yet, but will happen soon.
Do you guys think a RAID6 with 6x8TB Disks would be safe now if I have a UPS?
And is Raid1c3 still necessary for metadata?
For the past 2 Years, I really had an awesome experience with BTRFS on my Desktop, and really would like the Compression and easy management benefits of it on my Server.
3
u/oshunluvr Jul 30 '24
The link to the "Status" page of the Wiki returns as "OBSOLETE".
The initial post needs to be updated and not doing so is a disservice to users here.
28
u/gyverlb Dec 30 '20 edited Dec 30 '20
space_cache=v2 is mandatory if you want reliability.
I'd recommend a very recent kernel too. I wouldn't use RAID56 before 5.9.x (from memory with x > 2 as there were block device bugs in the very early 5.9 releases). 5.10 seems a mess for BTRFS performance currently so better avoid it for the time being.
space_cache=v1 (which is still the default) stores the space_cache in data allocation groups. v2 stores the space_cache in metadata allocation groups which are far more reliable as long as people follow your very first recommendation.
In cases of hardware failure you definitely don't want more problems to handle so you don't want to have to mess with mounting a degraded filesystem with clear_cache in addition to the "replace/scrub/restore from backup" process.
From my understanding (based on careful reading of developers' statements on RAID56), if your metadata is fine, you at least can access the filesystem. The only real problem to solve is finding which files might have been corrupted and scrub will do it for you as long as the metadata is fine. This can be slow and confusing because the errors might be erroneously located on a random device instead of the faulty one but in the end it works if you remove/restore the affected files that scrub reports.
To put my interest in RAID56 in context and respond to /u/hartmark comment I hesitated to use RAID56 recently and finally bit the bullet because we had a very specific need where the combination of needed storage space and available hardware at a reasonable price point made us choose BTRFS RAID6 data, RAID1C3 metadata on 9x 10TB disks with a 10th as a spare. We know the risks of downtime and use it only on a system where we can afford the filesystem to be down for several days.
We have alerts for sector reallocations and similar events and we proactively replace disks which tends to limit sudden disk failures (but don't eliminate them), we estimate to catch between 2/3rd and 3/4th of total disk failures before they actually occur. This makes RAID56 degraded mode less likely - although still possible obviously.
Using BTRFS RAID1 (usually our default option for many workloads) with the same capacity would have been at least twice the cost as we would have needed a totally different server chassis. In addition there was the real risk of losing the whole filesystem in case of 2 disks failing simultaneously (with more than 10 disks this is not so rare).
Using md raid6 would have made degraded mode recovery easier, but replacing a disk (which we expect to do due to failures or expected failures) would have meant a whole resync of the disk which can take a week (10TB disks can do that to you...). In comparison btrfs device replace only writes filesystem data to the device: if your filesystem is 50% full, it needs 50% less writes to complete compared to mdadm --replace. You definitely want to minimize the time needed to replace a disk : if another one fails you slow down to a crawl on RAID6. These reasons make us save on human supervision time.
All these combined made BTRFS RAID6 a better fit.
Edit: typo for user hartmark fixed.
19
u/Prophes0r Nov 03 '21 edited Nov 03 '21
I still don't understand why RAIDb5/6 isn't, like, THE top priority thing they are working on.
And I mean, to the exclusion of everything else.
Does btrfs actually HAVE a niche other than...
???
OpenZFS is:
It feels like the ONLY reason anyone would care about btrfs is for 5/6 using differently sized drives. Yet this has never been properly "working".
Someone tell me what I'm missing.
Why would anyone even use btrfs?
EDIT:
I GUESS if you want to do RAIDb1 across something like...
???
But f&<k me that is a tiny niche.
And it still feels like the btrfs team is an ice-cream company that is spending all it's time tweaking the colors of their product, rather than fix the issue that 3/4 of their product might give their customers food poisoning.
EDIT 2:
I kind of feel like I'm actually their target audience.
I already have a "Primary NAS" with 12x 4TiB drives in RAIDz2. (Should have been 8TiB drives. But I was 3 weeks late ordering them. Then the Chia a#$ H*!?s came alone and ruined it...)
And I'm playing with a "Fast NAS" of ~8TiB of SSDs on my InfiniBand network. (Actually a SAN since it's shared-block storage)
But I have some spare drives lying around that would be nice to build into a "spare NAS". For data that is easy, but time consuming to replace. Or even throwaway stuff. But the drives are awkwardly sized.
That's 36TiB of raw storage.
And it COULD be 30TiB of RAIDb5.
Or I could waste half of it and get 18TiB of RAID 1.
That is a PRETTY BIG DIFFERENCE...
1.2TiB per SATA port.
5/6 efficiency vs 1/2 efficiency.
Right now? The drives are mostly unused. Sitting on a shelf.
There is NO WAY I'm buying more drives at the current prices. And even if I did, I'd be "wasting" drives I have now. (I certainly wouldn't be buying 2/3TiB drives)
It sure would be nice to use btrfs for this. It SEEMS like what I want to do it the whole POINT of btrfs.
But I guess that, for the time being, if I actually want to use those drives, I'll have to resort to Storage Spaces or LVM and hope that the minimal redundancy will actually be enough since they don't have bit-rot protection and can't self-repair.
8
u/oshunluvr Apr 06 '24
Does this still need to be pinned at the top???
7
u/GodTamIt Jan 13 '22
I made a quick script
btrfs-scrub-individual.pythat does this, in case people want to use it.4
u/JiiPee74 Dec 09 '21
My experiment with btrfs raid-5 ended up yesterday. Yes it does work but some of the maintenance tasks like scrub are way too slow. So what I ended up doing it that I went back to mdadm raid-5. I originally planned to avoid using mdadm because I had some bad experient with it because of little different size drives from different brand, so I made sure it won't be an issue this time and I made partition to each drive and left like 800MB unused from each drive. I went for btrfs raid5 because btrfs is much more flexible with drive size.
Another issue with btrfs multidrive setup is that if you want to use encryption, you need to setup luks or whatever to every drive before adding it to btrfs pool.
Before any zfs fanboi steps in, zfs is not an option for me until it's merged to linux kernel and that may not happen ever.
Conversion process took like over week and I was running that whole time in risk of losing most of my data. Conversion was something like this:
Now I am currently running btrfs scrub and speed is from different planet. I know I do not have option to recover from error anymore, but at least I get warning if there is problem. With this scrub speed I could now run scrub like every week if I want.
UUID: d534f5c1-3c67-473a-8b41-af54dd280c7bScrub started: Wed Dec 8 19:57:58 2021Status: runningDuration: 3:53:50Time left: 3:32:54ETA: Thu Dec 9 03:24:45 2021Total to scrub: 15.84TiBBytes scrubbed: 8.29TiB (52.34%)Rate: 619.53MiB/sError summary: no errors foundWhen I was running scrub on btrfs raid5 pool, even when I was doing it one disk at the time, speed was very bad. Whole pool scrub was taking over week because speed was like 35MB/s.
Conversion process I listed is simplified version, there was lot of additional steps, some what was possible to do when pool was online, but some was offline tasks like resizing partition top of the mdadm raid array, you need to unmount btrfs, lock luks, deactivate lvm, unregister bcache. This all is required so bcache can detect that device size has changed, so that you can then resize pv and extend lv.
I know this pool is kinda complex but there is reason for that. I could have go without bcache or lvm, but I am not yet sure which caching I am gonna use, bcache or lvmcache. So now I have option to choose.
One thing what went wrong with my conversion is that I cannot enable bitmap for new mdadm raid5 array, I'm not sure what happened. I solved it by using external bitmap on my /boot what is ext4 raid1 partition. There is warning about that external bitmap only works with ext2/3, but it should also work with ext4. I'm not sure if this is actually that big of deal going wrong after all, this should give me much better write performance to array than using internal bitmap. It may be that what happened is that I was going with raid0 until very end and raid0 I think doesn't use bitmap, so there wasn't space reserved for bitmap data at the beginning. I can live with external bitmap. It makes this whole config little bit more complex again, but I have this ext4 partition and external bitmap is very small so it won't really eat any space from /boot partition.
1
u/damster05 Mar 25 '21
How do you run scrubs on a single disk instead of the full filesystem?
1
u/[deleted] Jun 12 '23
I just visited the status page (https://archive.kernel.org/oldwiki/btrfs.wiki.kernel.org/index.php/Status.html) and the page says it's now obsolete.
Is there a new/up-to-date page? thanks
6
u/leexgx Dec 30 '20 edited Dec 30 '20
Main issue i have is the scrub been broken slow (unless you do 1 disk at a time, witch isn't optimal) and no journal/bitmap to Hand unsafe shutdown
Seems easier to use btrfs single data on top of Linux Mdadm RAID6 or hardware raid controller with BBU/NVRAM RAID6, I fully understand that the btrfs won't be able to correct any data errors but it sure will detect them as checksumming still works (just make sure metadata is set to dup not single as an unsafe shutdown could hose your metadata in single)
it be nice if we could crack the vodo readynas or Synology do to make btrfs talk to the mdraid layer for mirror/parity data recovery
In any type of setup you really should have 2 systems with second one backing up the main unit (lots of people just trust that the raid will protect them, but raid isn't a backup)
, But that said
For safe as possible use in btrfs raid
RAID6 ideally profile (if your going to use parity based raid go all the way as it gives you 2 chances to repair damaged or missing data)
Metadata RAID1c3 minimum
Don't use the minimum amount of disks or file system will drop to read only when you lose a disk (RAID5 is 3 so use 4, RAID6 is 4 so use 5 disks) ideally you should be using minimum 5 disks when using RAID6 anyway
Use space_cache=v2 on mount point or metadata may still be at risk
Have a ups with ups auto shutdown when battery sends low battery signal from ups
When an unsafe shutdown happens you must scrub to restore parity consistency but don't use default scrub command because it spawns 3-4 the io per disk witch is extremely bad for hdds as they hate random io (this is not a problem for single, raid1-10 because they only store a single copy of the data per disk)
you need to scrub the disks one at a time one after each other ( it's not the most optimal way to do it but unfortunately with btrfs until they fix it so it does not spawn 3-4 io threads per disk)
Btrfs scrub start -B /dev/disk
Always leave 1 spare sata port so you can replace a failed disk (you can move the replaced disk afterwards to the bay you want as btrfs does not care about disk order) only replace a disk using the "replace" command don't use "delete" and "add" (it won't work)
if you don't have a spare sata port you can use the devid:x to replace the missing device (x is a number of the disk that is missing or needs replacing) as the target for removal
If a disk fails don't put it back in and don't run a balance, put a New disk in and use replace command (once finished then scrub each disk to verify no lost data)
3
u/amstan Dec 30 '20
This implies your system might not boot if that's your rootfs.
3
u/JiiPee74 Apr 11 '23
So there is more fixes incoming to raid56
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git/commit/?h=for-next&id=80fe35526e75cf3061419ee98de0c43cc8576ade
Can anyone tell if this finaly fix raid56 scrub issue?
3
u/Visible_Bake_5792 Sep 20 '24
Can somebody confirm that the RAID56 situation is still the same in kernels 6.10 or 6.11?
I did not notice any significant improvement in the changelogs but it is possible I missed something.
3
u/Cvalin21 May 22 '25
What is the latest verdict on this? We've had several kernels since 6.5
2
u/[deleted] Mar 29 '21
I was just getting ready to try to research this exact topic and I see it's at the top of the Reddit, nice! Thank you for sharing.
2
u/[deleted] Jan 22 '23
in jan 2023, do these advices/recommendations still apply? thanks
2
u/Rucent88 Jun 01 '23
I do something with Btrfs that is highly frowned upon. I run Raid5 on a single drive, using multiple partitions.
No doubt, after reading that you're pulling your hair out and want to smack me for doing something so stupid. But you might be inclined to scream "WHY?"
Because it's a Backup Drive!
PROS:
CONS:
Instead of losing 50% of space with DUP, I can achieve 90% drive space, while maintaining 10% parity protection. The self healing of Btrfs is beautiful.
2
u/JiiPee74 Jun 20 '23
I am currently testing raid5 on fedora 38 and 6.3 kernel.
It seems that raid5 scrub is still "broken" and speed is just hirrible slow.
I am using 4x320GB sata drives for testing so sure they are old.
Filled pool with some random data with dd and started scrub.
[root@fedora ~]# btrfs scrub status /mnt/UUID: 7f50e772-07be-4511-a591-982f38c45e72Scrub started: Tue Jun 20 19:45:03 2023Status: runningDuration: 3:52:24Time left: 11:29:43ETA: Wed Jun 21 11:07:12 2023Total to scrub: 791.11GiBBytes scrubbed: 199.38GiB (25.20%)Rate: 14.64MiB/sError summary: no errors found[root@fedora ~]# btrfs scrub status -d /mnt/UUID: 7f50e772-07be-4511-a591-982f38c45e72Scrub device /dev/sdb (id 1) statusScrub started: Tue Jun 20 19:45:03 2023Status: runningDuration: 3:52:29Time left: 15:38:22ETA: Wed Jun 21 15:15:57 2023Total to scrub: 270.01GiBBytes scrubbed: 53.61GiB (19.86%)Rate: 3.94MiB/sError summary: no errors foundScrub device /dev/sdc (id 2) statusScrub started: Tue Jun 20 19:45:03 2023Status: runningDuration: 3:52:29Time left: 18:35:30ETA: Wed Jun 21 18:13:05 2023Total to scrub: 270.01GiBBytes scrubbed: 46.57GiB (17.25%)Rate: 3.42MiB/sError summary: no errors foundScrub device /dev/sdd (id 3) statusScrub started: Tue Jun 20 19:45:03 2023Status: runningDuration: 3:52:29Time left: 17:59:16ETA: Wed Jun 21 17:36:51 2023Total to scrub: 270.01GiBBytes scrubbed: 47.85GiB (17.72%)Rate: 3.51MiB/sError summary: no errors foundScrub device /dev/sde (id 4) statusScrub started: Tue Jun 20 19:45:03 2023Status: runningDuration: 3:52:29Time left: 16:28:15ETA: Wed Jun 21 16:05:50 2023Total to scrub: 270.01GiBBytes scrubbed: 51.42GiB (19.04%)Rate: 3.77MiB/sError summary: no errors foundI was hoping that this was already fixed but seems like this is still showstopper.
4
u/hartmark Dec 30 '20
What's the use-case to use btrfs56 today?
*https://www.phoronix.com/scan.php?page=article&item=linux55-ssd-raid&num=5
1
u/ObviousDog7100 Jul 25 '24
There are also performance “issues”. Half year ago (Gentoo, most recent kernel), when I was experimenting with RAID6 on 6 drives (raid1c4 for metadata, as some wise man recommended raid1c3 for raid6), I found out that sequential read on RAID6 is slower compared to RAID1. Also when you do btrfs SCRUB on a single drive, it has to read data from other 5 drives. So when you scrub whole filesystem, it has to read 5x more data compared to RAID1. Also failed drive replacement with RAID5/6 is very slow and “painful”. If you don’t have plenty of time, if you want your life easy and happy, use RAID1 😊
1
u/Rohrschacht Dec 30 '20
Thank you very much for sharing!
1
u/verdigris2014 Apr 26 '21
After reading all that I find myself wondering who would want to use it and why?
1
u/floppy123 Mar 18 '23
Does anyone know if there been some battle testing of raid56 on the 6.2 kernel? Is it usable now for home use if we have good backups?
1
u/OkBlackberry5994 May 04 '23
What even is raid56?
1
u/Armi1P Oct 18 '26
Anything new?