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=-5.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 4D6E1C432C0 for ; Thu, 21 Nov 2019 10:21:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A8FF2073F for ; Thu, 21 Nov 2019 10:21:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ffBvtCKG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726358AbfKUKVU (ORCPT ); Thu, 21 Nov 2019 05:21:20 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36568 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfKUKVU (ORCPT ); Thu, 21 Nov 2019 05:21:20 -0500 Received: by mail-pf1-f194.google.com with SMTP id b19so1447293pfd.3 for ; Thu, 21 Nov 2019 02:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qyA35dJYEqlsdrJZw//tTOSmzXD+DDk5DTQtTEouFRg=; b=ffBvtCKG6oJMMFeMPE64Hid2cP9rj3PYnqMqCGRw0dUAaYc97sd+Xt/PtDfMTYsRdV HxpckFogqaHyV7Mi2T919Wm4SH+SW/3fRUlbVJlWOzCpf0wNBz1GM4pRI7/uXcfycVx5 qCHPbS692lmrnuRpLCu9xQxJ4cS2TqdrqHF0r/GhgPVibqv0ahy184YD7/HZWdT8eoOm /i1rmlTHsCVQhN0r1ngodVEya8tVq2SVE6UQUY699bRwZNYrIqUeWs7mOF/x8498lgvE 1/pYQhLT8fiZXNitYa1SGJrKfRFzaq9JGRuvJLVOS7xa6X4ONRiB7LDn6h3d3xHRs5l6 KKPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qyA35dJYEqlsdrJZw//tTOSmzXD+DDk5DTQtTEouFRg=; b=K0qtkWOiOu9Cn2wyFl6zpSYlfQ9tldYjnOMXSVpG+Zt3ZIfXAlhUfOcHgU6BfXrj8h EvHAFpgPeNNqpH9d8DmlysTPQ3CIB4xGcLJeO67GI+MFvUN9CpNO3GqwamiFUvkl8sxy gL0UUnSseoILd4CO5jgRrmMp/TIagmwu+quWc+Y9fxNdiVX+X03JpG8970ktUAQxf5tq dw6T5qgLu9XIwJjoO6uO9UwvffO3EBg9YxI+IPrZ3rR4HTJ3JeNTXtboojXlQsIHFoZR a5fdyVgTnVjGk/9U0oNkAqcjwEOwdMbcdcnpfaaq4fj3pTzpjFRUU7c7BVfsE31vAcfQ yWmg== X-Gm-Message-State: APjAAAUxBfBblupAfeG7yI4q9b2tcad+FAJyBrh91yC4yvzEd9FDWH5o CpLUmw2PmZWXKcxAkipYv2+7cRYim1TRXw== X-Google-Smtp-Source: APXvYqxy2AXLIrMFyi9Iyw8f78o98DJ1jRDPMmD3kG2B6QeQgqvlg8+WjFjXGqGs93BAQi+ROZbQug== X-Received: by 2002:a63:43c3:: with SMTP id q186mr8034473pga.95.1574331678620; Thu, 21 Nov 2019 02:21:18 -0800 (PST) Received: from [192.168.1.145] ([39.109.145.141]) by smtp.gmail.com with ESMTPSA id k32sm2482101pje.10.2019.11.21.02.21.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Nov 2019 02:21:17 -0800 (PST) From: Anand Jain X-Google-Original-From: Anand Jain Subject: Re: How to replace a missing device with a smaller one To: Zygo Blaxell , Qu Wenruo Cc: dsterba@suse.cz, Nathan Dehnel , Btrfs BTRFS References: <58154d62-7f6e-76ee-94d5-00bfcd255e59@gmx.com> <20191119143857.GU3001@twin.jikos.cz> <0a8fd2a8-12fe-f899-5a53-b5f584a35878@gmx.com> <20191120000524.GE22121@hungrycats.org> Message-ID: Date: Thu, 21 Nov 2019 18:21:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191120000524.GE22121@hungrycats.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 11/20/19 8:05 AM, Zygo Blaxell wrote: > On Wed, Nov 20, 2019 at 08:02:43AM +0800, Qu Wenruo wrote: >> >> >> On 2019/11/19 下午10:38, David Sterba wrote: >>> On Mon, Nov 18, 2019 at 03:08:00PM +0800, Qu Wenruo 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. >>> >>> So it can be recteated eg. on loop devices, where some of them are >>> slightly smaller, then go missing and replace is started, right? >>> >> >> Replace will still be rejected, but we can do resize of that missing >> dev, then replace, as a workaround. >> >> I haven't do the auto-resize for replace yet, since I'm not sure if that >> could make cases like replacing 1T device with 10G driver happening. > > That case would be much more tolerable if device replace/resize/delete would > stop to check for fatal signals at least between block groups, if not more > often. Currently if you pick the wrong size, the only way to make it stop > is to reboot. I agree. IMO too btrfs replace --