linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: Roman Mamedov <rm@romanrm.net>, linux-btrfs@vger.kernel.org
Subject: Re: btrfs progs always assume devid 1?
Date: Wed, 5 Dec 2018 15:10:52 -0500	[thread overview]
Message-ID: <42e4ba30-2535-e2f3-6ecb-539fe8fda947@gmail.com> (raw)
In-Reply-To: <20181206005049.3642ebd0@natsu>

On 2018-12-05 14:50, Roman Mamedov wrote:
> Hello,
> 
> To migrate my FS to a different physical disk, I have added a new empty device
> to the FS, then ran the remove operation on the original one.
> 
> Now my FS has only devid 2:
> 
> Label: 'p1'  uuid: d886c190-b383-45ba-9272-9f00c6a10c50
> 	Total devices 1 FS bytes used 36.63GiB
> 	devid    2 size 50.00GiB used 45.06GiB path /dev/mapper/vg-p1
> 
> And all the operations of btrfs-progs now fail to work in their default
> invocation, such as:
> 
> # btrfs fi resize max .
> Resize '.' of 'max'
> ERROR: unable to resize '.': No such device
> 
> [768813.414821] BTRFS info (device dm-5): resizer unable to find device 1
> 
> Of course this works:
> 
> # btrfs fi resize 2:max .
> Resize '.' of '2:max'
> 
> But this is inconvenient and seems to be a rather simple oversight. If what I
> got is normal (the device staying as ID 2 after such operation), then count
> that as a suggestion that btrfs-progs should use the first existing devid,
> rather than always looking for hard-coded devid 1.
> 

I've been meaning to try and write up a patch to special-case this for a 
while now, but have not gotten around to it yet.

FWIW, this is one of multiple reasons that it's highly recommended to 
use `btrfs replace` instead of adding a new device and deleting the old 
one when replacing a device.  Other benefits include:

* It doesn't have to run in the foreground (and doesn't by default).
* It usually takes less time.
* Replace operations can be queried while running to get a nice 
indication of the completion percentage.

The only disadvantage is that the new device has to be at least as large 
as the old one (though you can get around this to a limited degree by 
shrinking the old device), and it needs the old and new device to be 
plugged in at the same time (add/delete doesn't, if you flip the order 
of the add and delete commands).

      reply	other threads:[~2018-12-05 20:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05 19:50 btrfs progs always assume devid 1? Roman Mamedov
2018-12-05 20:10 ` Austin S. Hemmelgarn [this message]

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=42e4ba30-2535-e2f3-6ecb-539fe8fda947@gmail.com \
    --to=ahferroin7@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=rm@romanrm.net \
    /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).