linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Dehnel <ncdehnel@gmail.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: How to replace a missing device with a smaller one
Date: Sun, 24 Nov 2019 17:02:41 -0600	[thread overview]
Message-ID: <CAEEhgEvGA5o4W5q_P-0a+AW_Aze4L8BKmrSDzdAtJDBvfPgKsA@mail.gmail.com> (raw)
In-Reply-To: <d9cc411e-804d-d1c4-f65f-60a9c383b690@gmx.com>

The patch worked. Thanks for the help.

On Mon, Nov 18, 2019 at 1:08 AM Qu Wenruo <quwenruo.btrfs@gmx.com> 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
> >
>

  parent reply	other threads:[~2019-11-24 23:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  2:09 How to replace a missing device with a smaller one Nathan Dehnel
2019-11-18  5:32 ` Qu Wenruo
2019-11-18  7:08   ` Qu Wenruo
2019-11-19 14:38     ` David Sterba
2019-11-20  0:02       ` Qu Wenruo
2019-11-20  0:05         ` Zygo Blaxell
2019-11-21 10:21           ` Anand Jain
2019-11-24 23:02     ` Nathan Dehnel [this message]
2019-11-20 17:07   ` Chris Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEEhgEvGA5o4W5q_P-0a+AW_Aze4L8BKmrSDzdAtJDBvfPgKsA@mail.gmail.com \
    --to=ncdehnel@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).