Am Donnerstag, 5. Januar 2012 schrieb Fabian Zeindl: > On Thursday, January 5, 2012 at 10:44 , Hugo Mills wrote: > > You should probably read the mis-named "Sysadmin's Guide" > > on the wiki[1], which explains what btrfs actually does with its > > replication. > > > > You should also probably read the FAQ entries on free space[2], > > since using plain "df" for btrfs is usually misleading. > > I read both, but it doesn't answer my question on how btrfs behaves > when it can't actually do a raid1, because there's not enough data on > an "other" disk for a chunk-copy. >From my reading that Sysadmin Guide answers your question: BTRFS with RAID-1 will allocate chunks on two devices: > Btrfs's "RAID" implementation bears only passing resemblance to > traditional RAID implementations. Instead, btrfs replicates data on a > per-chunk basis. If the filesystem is configured to use "RAID-1", for > example, chunks are allocated in pairs, with each chunk of the pair > being taken from a different block device. Data written to such a chunk > pair will be duplicated across both chunks. > > Stripe-based "RAID" levels (RAID-0, RAID-10) work in a similar way, > allocating as many chunks as can fit across the drives with free space, > and then perform striping of data at a level smaller than a chunk. So, > for a RAID-10 filesystem on 4 disks, data may be stored like this: [… quoted from the Wiki page …] "Allocating as many chunks as can fit across the drives" is also pretty clear to me. So if BTRFS can´t allocate a new chunk on two devices, its full. To me it seems obvious that BTRFS will not break the RAID-1 redundancy guarentee unless a drive fails. Thus when using a RAID-1 with two devices, the smaller one should define the maximum capacity of the device. But when you use a RAID-1 with one 500 GB and two 250 GB drives, BTRFS can replicate each chunk on the 500 GB drive on *one* of the both 250 GB drives. Thus is makes perfect sense to support differently sized drives in a BTRFS pool. My own observations with a RAID-10 across 4 devices support this. I echo´d "1" > /sys/block/sdX/delete to remove one harddisk while a dd was running to the RAID. BTRFS used the remaining disks. On next reboot all disks where available again. While BTRFS didn´t start rebalancing the RAID automatically a btrfs filesystem balance made it fill up the previously failed device until all devices had the same usage. This is also described in the sysadmin guide: So this is what you have to care for manually. If a drive failed, you have to balance the filesystem so that it creates replicas where they are missing. Now anyone deeper into BTRFS please check at whether my understanding matches what BTRFS is doing… > > You could run a scrub, which will verify all of the data mirrors on > > the volume, and fix anything that's not redundant. > > Will this command fail then for example? No, unless more than the allowed number of disks are failing. -- Martin 'Helios' Steigerwald - http://www.Lichtvoll.de GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
