Re: btrfs balance to add new drive taking ~60 hours, no progress?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 1, 2020 at 6:26 PM Rich Rauenzahn <rrauenza@xxxxxxxxx> wrote:
>
>
>
> On Sun, Mar 1, 2020 at 5:10 PM Chris Murphy <lists@xxxxxxxxxxxxxxxxx> wrote:
>>
>> Free is 1.82 exactly half of  unallocated on one drive and no
>> unallocate on the other drives, so yeah this file system is 100% full.
>> Adding one drive was not enough, it's raid1. You needed to add two
>> drives.
>
>
> I'm not following the btrfs logic here - I had three drives, 2 x 1 TB and a 1 x 4 TB and added a 4TB.

The original three drives:

        devid    2 size 1.82TiB used 1.82TiB path /dev/sda1
        devid    3 size 1.82TiB used 1.82TiB path /dev/sdc1
        devid    4 size 3.64TiB used 3.64TiB path /dev/sdb1

Simplistically, devid 2 mirrors with 50% of devid 4, and devid 3
mirrors with the other 50% of devid 4. You have 4TB of data on an 8TB
volume in a raid1 configuration. That's completely full and using up
all space.

Then you added one drive. Doesn't matter what its size is. There's no
where for more data to go.

https://carfax.org.uk/btrfs-usage/

>
> That was a total of 4TB in RAID0.

The volume is 8TB in a RAID 1 before adding the 4th drive. You can put
4TB of data on that volume, and it will be full and balanced.

> Wouldn't adding a fourth drive give me 6TB and some of the blocks just moved from the three drives onto the fourth?

Adding one 4TB drive gives you one empty 4TB, and three full drives.
The first copy of a chunk can go to the new drive, but there's nowhere
for the 2nd copy to go because the other three drives are full.


> Is there a particular 2nd copy policy I'm not aware of?

Btrfs raid1 is not block based like either mdadm or LVM raid. It's
based on the block group. A data block group is typically 1GiB. When a
data block group has raid1 profile, it has two stripes. In this case a
stripe is a copy.  Using your devid 2, 3, 4 where 2 and 3 are the same
size and devid 4 is 2x you have three possible kinds of blockgroup
stripe combinations:

2+3
2+4
3+4

How many you have of each just depends on the life history of the
volume; but if it were never balance and all three drives were
together from the start,  you might in theory have only 2+4 and 3+4
block groups.


> Or is it that it is trying to create new allocations on the new drive as part of the balance but can't because they wouldn't be mirrored?

Correct. The balance must move "the block group" and there are
effectively two copies. You have room for one to be moved. Not two.

If there was even 10GiB unallocated on one of the drives, this would
be going a LOT faster. But it looks like the three drives were full
before you got started (?) so it's wedged itself in.


 >But I still don't get why it wouldn't move blocks from the full drives...

To where? There's only one drive with unallocated space.



-- 
Chris Murphy



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux