From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96816C432C0 for ; Sun, 24 Nov 2019 23:02:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E8A22075E for ; Sun, 24 Nov 2019 23:02:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oqnEzZor" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727004AbfKXXC4 (ORCPT ); Sun, 24 Nov 2019 18:02:56 -0500 Received: from mail-wm1-f46.google.com ([209.85.128.46]:37915 "EHLO mail-wm1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726855AbfKXXC4 (ORCPT ); Sun, 24 Nov 2019 18:02:56 -0500 Received: by mail-wm1-f46.google.com with SMTP id z19so13681694wmk.3 for ; Sun, 24 Nov 2019 15:02:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vXV1A+sWj2UjrsjRNGom/tFpvSQNM7NO+kTC8mgKUCE=; b=oqnEzZord8L5Pa/Cv4RZEuHJIJglKRYalyOOE0WMJ/5rRAAK9mmNky67J2KhWT1nFg N8SPoLSQTcK01NpE1rx/XIsMjB9QMSO8iRnNLHDR3G8ibS5cQCbCdIpSFm74bwijq5rA wod6opOWkkqufVbmRe00PaTdeJHnVopcdJNfM8iWY5/e23//SCx/zH4bjFGCKGKd186H GCm3b6cETyA5HRsnPsz6LXez1Z9kx82bYS0mevIL83r6nU5b/YvmzTN9rSc6ohMP4gCa qlLs1cYy5lM8BfSRbV37114JYAkkLk6Yrt3uKKpHUTJRB8wYQYucTzBT31rvQo72sXaR vJ6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vXV1A+sWj2UjrsjRNGom/tFpvSQNM7NO+kTC8mgKUCE=; b=SRG4ojd4HGwn1teZg4/RDd3MHigA+xMMPuxDDI3JXYKPiOeL0ANntonzDYVxY0XCS+ smVvIsaYeKfCgc9xjSwHlSY+2poUz22V8h2QSN9PQxPFRKIhLV+/YLgkxg02pJDYm+Cz x7TNJ+RuKdZ4tfz/HwscCvRnqgTbJUjdcCqX6M3kk75aLwL9pzSDE+Y5sGyow/4iJ4KC 8oAEFv7Y9hSUb/BzCYmnLWvkRrv6tBKcOM04UcIB8aA9ZO57oJ95Ys4We8kRNBDUy/or WmYZ+p01mZkpHfo6XueBQwo3bbkVAopl2+hCnOJN+Y23BYBXWokHfVtcyXufP8cwG7uS BGeg== X-Gm-Message-State: APjAAAVq1lfW0lheg+neUXD0DDoULS3WvjOwKGkJetzD4gpjTgMmC8fw MTEdOq2zYjhkMJPN95bZHhVMQ9RFTsrX0K6dRPU= X-Google-Smtp-Source: APXvYqwc2/2KD6vd1lQXtY5MwlCpIcLv8nl4MIttMelYEEIE5nhmtxhNYxdovT4cES30OYeuBQQPTw8y7lEcFRMqpbw= X-Received: by 2002:a1c:7519:: with SMTP id o25mr25391869wmc.70.1574636573521; Sun, 24 Nov 2019 15:02:53 -0800 (PST) MIME-Version: 1.0 References: <58154d62-7f6e-76ee-94d5-00bfcd255e59@gmx.com> In-Reply-To: From: Nathan Dehnel Date: Sun, 24 Nov 2019 17:02:41 -0600 Message-ID: Subject: Re: How to replace a missing device with a smaller one To: Qu Wenruo Cc: Btrfs BTRFS Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The patch worked. Thanks for the help. On Mon, Nov 18, 2019 at 1:08 AM Qu Wenruo wrote: > > > > On 2019/11/18 =E4=B8=8B=E5=8D=881:32, Qu Wenruo wrote: > > > > > > On 2019/11/18 =E4=B8=8A=E5=8D=8810: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 100020309196= 8 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 > > >