Why does removing a drive from a pool require a rebalance?


Recommended Posts

Hi all, just a general question about btrfs pools.  I recently wanted to remove an SSD from my raid1 pool, so I unassigned it and then restarted the array. To my suprise, instead of the pool starting up in some degraded mode, it instead seemed to begin a mandatory rebalance with the unassigned SSD to switch them to "single" operation, after which I assume it will remove it.

 

According to this article, that seems to be normal for removing a device.  So my question is, for a raid1 with two devices, to a raid1 with 1 (degraded, but still the same), why does a rebalance have to occur - If I were to simply remove the SSD physically, it would keep working, so why does it need to rebalance if the drive is instead not removed?

 

I'm running 6.9.0-beta29, but about to downgrade to beta25 because of the vfio drive passthrough issues.

 

image.png.c3fe7ca8ae915ca6795d620f6800b2ea.png

Edited by Alexstrasza
Link to comment

I've found the original command-line run by UnRaid:

Oct  4 01:45:47 Sector5 emhttpd: shcmd (41): /sbin/btrfs balance start -f -dconvert=single -mconvert=single /mnt/cache && /sbin/btrfs balance start -f -dconvert=single,soft -mconvert=single,soft /mnt/cache && /sbin/btrfs device delete /dev/nvme0n1p1 /mnt/cache &

That would seem to match up with what I've observed:

  1. Convert to single (striped?) mode
  2. Convert again?
  3. Then finally copy the data off the SSD I want to delete.

So I'm still confused as to why UnRaid chooses to do steps 1 & 2 rather than skipping to step 3.

Link to comment
9 hours ago, JorgeB said:

To make the pool not degraded.

But can't this be done after the remove operation, to save time waiting for the rebalance across the "removed" SSD?

9 hours ago, JorgeB said:

These are only one operation, balance is what converts the pools to single mode.

I get that, but I don't understand why the command line calls it twice, the second time with "dconvert=single,soft" instead.

Link to comment
15 hours ago, Alexstrasza said:

But can't this be done after the remove operation, to save time waiting for the rebalance across the "removed" SSD?

No, balance is what "removes" the member pool.

 

15 hours ago, Alexstrasza said:

I get that, but I don't understand why the command line calls it twice, the second time with "dconvert=single,soft" instead.

LT most likely did that because some times a balance leaves some old profile chunks unconverted, note that the "soft" balance will only balance those chunks, if there are any, it won't re-balance what is already balanced.

  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.