My journey with Btrfs - Part 2 Bis - Conversation IRC -
My conversation on #Btrfs . I had some questions after my first experience with Btrfs.
Vaur hello, I have setup a btrfs filesystem with raid 5 data, on two 2TB harddrives. I wanted to see what was btrfs doing with my datas, like how it was spreading it to my devices. but it seems to be behaving like a raid 1
Vaur my questions are: is it normal for it to behave like this ? and if yes, why is it reporting to have 3.6 TiB free space, when it should have only 1.8 TiB ?
kahiru raid 5 on 2 drives?
kahiru don't you need at least 3 drives for raid5?
Vaur kahiru: not with btrfs, the minimum requirement is 2 drives
kahiru cool, didn't know that
Vaur though with just 2 drives it looks exactly like a raid 1
Vaur I'm guessing that with just 2 drives it's like a raid 1, and if you add more drives it will become a raid 5
Vaur this is just a wild guess though, that's why I'm asking here
kahiru well, on my machine it doesn't let me to convert two drives to raid5
Vaur kahiru: with btrfs ?
Vaur for me it created the raid just fine: http://paste.debian.net/414274/
kahiru hmm, it works this way, but it shows me 8EiB free space (on 2x10GiB) and cannot be balanced to another profile. looks like a bug to me
Vaur 8EiB ? what ?
kahiru seems broken a bit
Vaur agreed, what is your kernel version ?
Vaur I'm running 4.3
Vaur make a bug report ?
darkling With RAID-5 on two devices, yes, it's pretty much exactly like RAID-1.
Vaur darkling: alright, then why is it reporting to have 3.6 TiB of spaces ?
Vaur is it a bug ?
Vaur darkling: humm it's weird, wiki says that in the case of 2HD RAID 5 one drive has the parity, the other got the data
Zygo if the parity is even, the parity bits are the data bits
Zygo i.e. for each bit, D1 ^ D2 == 0
Zygo so they're equal
Vaur but if my data drive fails, wont the parity drive be useless ?
Zygo only for two disks, though. For three it's D1 ^ D2 ^ D3 == 0, and suddenly it matters which ones are data and which are parity
darkling There's no "data drive" and "parity drive".
darkling The parity location rotates around between them.
darkling If it didn't, it would be RAID-4.
Vaur quoting btrfs wiki: "In case of a 2 device RAID5 filesystem, one device has data and the other has parity data."
darkling Yeah, well, it's easier to say that than to explain all the mucky details.
Zygo that's a consequence of the way the math works in the two-disk special case
Vaur darkling: rotate ?
darkling It's functioanlly equivalent.
darkling The first 64k stripe puts parity on device 1, the second 64k stripe puts parity on device 2, and so on.
darkling (The starting device and the direction of rotation may be different)
Zygo if they're laid out with the right parameters, 2-disk raid5 and 2-disk raid1 are identical on the disk
Zygo so you have two identical disks, you could call one data and one parity, or you could call half the blocks on one data and the other half parity. No difference on the disks.
Vaur so if I got this right, half of the space in one disk contains data, the other half contains the parity for the second disk
Vaur are am I totally wrong ?
darkling That's about right.
darkling And vice versa, of course.
Zygo the parity stripe rotates between the disks so that one disk doesn't become a bottleneck for writes
darkling I guess that's for the case with sub-stripe writes.
Vaur what happens if instead of having 2 hard-drive of similar size I had a 1TB and a 2TB ?
darkling Then you'd only get to use the first 1 TB of the larger devices.
Vaur and if I had a 1TB to my existing array of 2 2TB, will it decrease the size of my array ?
darkling See http://carfax.org.uk/btrfs-usage for how unequal-sized devices get used.
Zygo in raid5 the data size is the total size of all the disks except the largest one
Vaur alright that's easier then
darkling Or if you *really* want to work it out yourself, I just posted the general algorithm to the mailing list. :)
Vaur so I cant add a 1TB to my existing 2 2TB file system, without reducing the total disk space
darkling Well, your existing 2TB device is single data.
darkling So if you add a new 1TB device and don't convert, you'll get a total of 3 TB of single data usable.
darkling If you add a new device and convert to RAID-1 or RAID-5, then yes, you'll drop from 2 TB usable to 1 TB usable.
darkling Again, see the website tool above...
Vaur darkling: I did see it but sadly I dont understand it
darkling Put in the number of devices, set the size (in GB) for each device, select the RAID level you want, and read off the total usable space...
Vaur the settings on the left was what throwing me off
darkling Those are for possible future config parameters.
Vaur ah I see now
Vaur thanks a lot for your answers and your time
This article is my 4th oldest. It is 931 words long, and it’s got 0 comments for now.