* Re: Cancel device remove?
2015-09-10 13:18 ` Piotr Pawłow
@ 2015-09-10 13:47 ` Austin S Hemmelgarn
0 siblings, 0 replies; 3+ messages in thread
From: Austin S Hemmelgarn @ 2015-09-10 13:47 UTC (permalink / raw)
To: Piotr Pawłow, Paul Jones, linux-btrfs@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]
On 2015-09-10 09:18, Piotr Pawłow wrote:
> Hello,
>> Is there some way to cancel a device remove operation? I have
>> discovered that if I reboot that will cancel it, but that's not always
>> possible. What I'm after is something the same as cancelling scrub.
>> I keep running into situations where I want to pause a remove
>> operation for speed reasons.
>
> Since removing a device involves shrinking it to 0 size first
> (http://lxr.free-electrons.com/source/fs/btrfs/volumes.c#L1743), I guess
> you could just run "btrfs filesystem resize" in a loop as a workaround,
> shrinking it incrementally, and then remove at the end.
OK, what I'm about to say may be absolutely totally wrong, you have been
warned. If I understand the code correctly, device remove is internally
equivalent to shrinking the device to 0 size, and then running a
balance, then deleting the device from the FS metadata. Based on this,
I 'think' than you may be able to use btrfs balance cancel on the FS to
stop the device remove, and then optionally do a resize to revert the
remove. However, even it this does work, it probably isn't a
particularly good idea. I would love to see some way in the tools to
pause/cancel this just like a scrub or balance however.
It is worth noting that you should be able to limit the disk
bandwidth/set the I/O priority of the operation by using either
cgroups/ionice respectively on the userspace command (unlike a replace
operation, a device removal is synchronous, and should inherit the I/O
scheduler parameters from the command that invoked it).
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3019 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread