10
2
I currently have a Btrfs partition with four devices: three 3 TB drives and a 4 TB drive. Data and metadata are RAID 10, so I have 6 TB of usable space, which is almost full. I'd anticipated that RAID 5 support in Btrfs would be mature by the time my storage filled up, but apparently it's not a priority.
My question is: is there a reason to prefer RAID 10 over RAID 1? I know real RAID 1 on my current hardware should give me 3 TB of usable space with 4 copies of each block, but Btrfs apparently does not behave this way. From the Btrfs FAQ:
btrfs combines all the devices into a storage pool first, and then duplicates the chunks as file data is created. RAID-1 is defined currently as "2 copies of all the data on different devices". This differs from MD-RAID and dmraid, in that those make exactly n copies for n devices. In a btrfs RAID-1 on three 1 TB devices we get 1.5 TB of usable data. Because each block is only copied to 2 devices, writing a given block only requires exactly 2 devices to be written to; reading can be made from only one.
And from Jens Erat on Stack Overflow:
Btrfs distributes the data (and its RAID 1 copies) block-wise, thus deals very well with hard disks of different size. You will receive the sum of all hard disks, divided by two – and do not need to think on how to put them together in similar sized pairs.
If more than one disk fails, you're always in danger of losing data: RAID 1 cannot deal with losing two disks at the same time. In your example given above, if the wrong two disks die, you always lose data.
Does this mean that rebalancing from RAID 10 to RAID 1 will give me an extra 500 GB of data (6.5 TB rather than 6 TB) due to the 4 TB drive? And is there any reason for me to stick with RAID 10?
1BTRFS RAID-5 is (although still experimental) actually pretty stable and even many typical data recovery scenarios work in the current version (without crashing). You should probably scrub from time to time to make sure your data is still correct, but it might be worth a shot. It's possible to convert from RAID-1(0) to RAID-5. – basic6 – 2015-11-12T17:31:48.373
@basic6 Good to know, thanks. I was researching that not long ago and saw that
scrub
andreplace
support had been added as of 3.19, but people were still complaining about the lack of devices failure alerts. I do have crons set up for weekly scrubs and weekly/monthly SMART self tests, so I should be able to catch those issues. I'll give it a try. – Mikkel – 2015-11-12T21:36:19.927Periodic (weekly or monthly) scrubs are important, if a scrub finds and error because it can't read from a drive, it will increase the error count. Check the error count using
– basic6 – 2015-11-13T07:45:10.547dev stats
, which could be another cronjob.