The patch worked. Thanks for the help. On Mon, Nov 18, 2019 at 1:08 AM Qu Wenruo <quwenruo.btrfs@xxxxxxx> wrote: > > > > On 2019/11/18 下午1:32, Qu Wenruo 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 have CCed you with a patch to allow user to *shrink* the missing device. > > You can also get the patch from patchwork: > https://patchwork.kernel.org/patch/11249009/ > > Please give a try, since the device size is pretty small, I believe with > that patch, we can go quick shrink, that means "btrfs fi resize" command > should return immediately. > > Then you can go regular replace, this should save you a lot of IO by > avoiding the IO/time consuming device removal. > > Thanks, > Qu > > > > >> 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. > > > > Thanks, > > Qu > > >
