-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
btrfs balance single targeting a single devid didn't move all the data to that device #907
Comments
The There currently isn't a good way to move data from all devices to one device while also changing profile without moving the data multiple times. You can alternate between resizing devices 1, 3, 4, and 5 smaller, in 1 GiB increments, so that they have less unallocated space than device 2, then perform some of the conversion to single when device 2 has more unallocated space than the others, then stop the balance when the unallocated space is equal and go back to resizing the other devices smaller again, repeating all of that until all data has been removed from devices 1, 3, 4, 5. This reduces the number of data movements, but it requires a shell If this is a feature request: it's a fairly straightforward patch to disable allocation on some devices (a variant of the existing allocation preferences patch with the "allocate nothing" extension). Once that is merged, then this operation can be performed in two steps:
With allocation disabled on devices other than device 2, balance will have no choice but to reallocate all the data there. |
Yes, this is correct.
I guess it is now, since it is not currently possible to "un-balance" data off of disk in preparation for removal. It sounds like the no allocation preferences will address this. |
I've implemented a |
Please do not do this. This is a frequent misunderstanding, and I realize you and others who have proposed this in the past have good intentions, but breaking the The purpose of "none-only" is to force the filesystem to give up on allocation immediately, and return ENOSPC quickly, before making a mess that will take days to clean up. The unexpected out-of-space situation that The "preferred" variants allow data to spill over onto low-preference devices when space runs low. This is highly undesirable in cases like e.g. reducing an array from 12 disks down to 8. Balances on arrays that large can take weeks or months to run. If someone dumps a lot of data on the filesystem and it spills over onto devices we're trying to remove, we can lose days of IO time putting the data on the wrong devices before anyone notices (it's a month-long balance, we don't check what it's doing every day), and then more days of IO time taking the data off again. We'd rather just have the filesystem fill up and stop accepting more data, so there's no need to do extra work to clean up in the unexpected out-of-space scenario. Putting data on a device we've told btrfs not to is bad. What if we set Ideally there should be a sanity check to make sure the filesystem has the minimum number of drives for each profile, and reject a "-only" preference if it would mean e.g. there's only one drive for raid1 data. If, as a result of an "-only" preference, there's not enough space to allocate something, then the filesystem is merely full. There's no need to start putting data in unexpected places unless the user explicitly requests that by using Note that even if all existing drives are "none-only", btrfs can still allocate metadata in block groups that already exist. So it's not necessarily a problem even if on paper the configuration seems insane. It doesn't add any new failure modes compared to filling up all the drives on an unpatched btrfs. If we solved that problem, the solution would work without modification on preferred metadata too. |
Okay, I understand the use-case. Then I should add the But doesn't that essentially make it an operation of |
Exactly. With the |
This is a very easy explanation to follow. I'll add that use-case to my patch then. Thanks @Zygo. |
This is useful where you want to prevent new allocations of chunks to a set of multiple disks which are going to be removed from the pool. This acts as a multiple `btrfs dev remove` on steroids that can remove multiple disks in parallel without moving data to disks which would be removed in the next round. In such cases, it will avoid moving the same data multiple times, and thus avoid placing it on potentially bad disks. Thanks to @Zygo for the explanation and suggestion. Link: kdave/btrfs-progs#907 (comment) Signed-off-by: Kai Krakow <[email protected]>
I executed:
btrfs balance start --force -sconvert=single,devid=2 -dconvert=single,devid=2 -mconvert=single,devid=2 /storage
With the intention of moving devices 1,3,4 and 5 from my btrfs filesystem.
The command ran overnight and I found afterwards that device 4 and 5 had been vacated of data, but devices 1 and 2 had equal amounts, although everything was now stored as "single"
The text was updated successfully, but these errors were encountered: