Best strategie to remove devices from pool
Hi,
I want to remove two devices from a BTRFS RAID 1 pool. It should be enough free space to do it, but what is the best strategie. Remove both device in one call 'btrfs dev rem /dev/sda1 /dev/sdb1' (for example) or should it be better in two separate calls? What is faster? Are there other constraints to think about?
Bye
Frank
Cloud Admin posted on Tue, 17 Oct 2017 19:58:55 +0200 as excerpted:
Quoted 6 lines
Hi,
I want to remove two devices from a BTRFS RAID 1 pool. It should be enough free space to do it, but what is the best strategie. Remove both device in one call 'btrfs dev rem/dev/sda1/dev/sdb1' (for example) or should it be better in two separate calls? What is faster? Are there other constraints to think about?
As a general policy, I'd first ensure that I had current backups in case something goes wrong, unless of course you consider the data trivial enough not to bother with backups. No sense unnecessarily tempting fate. =:^\
Then I'd use the two devices in one call remove, because btrfs device remove has an implicit rebalance that moves chunks off the device being removed to the other available devices, and a rebalance can take awhile, so doing two removals at once should go much faster than one at a time.
I'd also suggest that if you use btrfs quota functionality, you disable it at least while doing the removes/balances, as trying to recalculate the quotas constantly slows things down considerably, and if you have lots of subvolume snapshots on the filesystem, I suggest you first delete as many of those as you can reasonably delete (and turn off any scheduled snapshotting during the remove/rebalance), as well, because they too can slow down balances quite a bit.
Signature · 3 lines
Duncan - List replies preferred. No HTML msgs. "Every nonfree program has a lord, a master -- and if you use the program, he is your master." Richard Stallman
Quoted 6 lines · Cloud Admin
Hi,
I want to remove two devices from a BTRFS RAID 1 pool. It should be enough free space to do it, but what is the best strategie. Remove both device in one call 'btrfs dev rem/dev/sda1/dev/sdb1' (for example) or should it be better in two separate calls? What is faster? Are there other constraints to think about?
Ideally, delete them all with a single operation. Internally the delete command uses some numeric trickery together with a balance operation to migrate the data off of the devices being removed. If you do them one at a time, you will end up moving at least some data twice, and thus wasting time. Other than that, there's not much to worry ab out, though keep in mind that deleting devices from an array can take a long time, especially if the array is mostly full.