Re: How to replace a missing device with a smaller one

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

 



On Sun, Nov 17, 2019 at 10:32 PM Qu Wenruo <quwenruo.btrfs@xxxxxxx> wrote:
>
>
>
> On 2019/11/18 上午10:09, Nathan Dehnel wrote:
> > I have a 10-disk raid10 with a missing device I'm trying to replace. I
> > get this error when doing it though:
> >
> > btrfs replace start 1 /dev/bcache0 /mnt
> > ERROR: target device smaller than source device (required 1000203091968 bytes)
> >
> > I see that people recommend resizing a disk before replacing it, which
> > isn't an option for me because it's gone.
>
> Oh, that's indeed a problem.
>
> We should allow to change missing device's size.
>
> > I'm replacing the drive by
> > copying from its mirror, so can I resize the mirror and then replace?
> > How do I do that? Do I need to run "btrfs fi res" on each of the
> > remaining drives in the array?
> >
> As a workaround, you could remove that missing device (which would
> relocate all chunks using it, so it can be slow).
>
> Then add the new device to the fs.
>
> With that done, it's recommended to do a convert to take full use the
> two added devices.

I think I'd advise adding the new device, and then removing the
missing device, rather than the other way around.

remove before add means the redundancy has to be re-established on the
remaining drives, device add then only increases fs capacity, and then
a balance is necessary to actually use the new device. Basically it
will cause two restripe tasks to happen.

add before remove, means the new device is available and will be used
during the redundancy being re-established (chunk replication); a full
balance won't be necessary, just check 'btrfs fi us' to see if there
are any single chunks for some reason, and if so a filtered
convert,soft balance can be done to convert them to raid10. This means
no restripe, just re-establishing the replication, and maybe a
"cleanup" filtered balance at the end to make sure all chunks are in
fact raid10.



-- 
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