Linux-BTRFS Archive on lore.kernel.org
 help / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: "Jakob Schöttl" <jschoett@gmail.com>, linux-btrfs@vger.kernel.org
Subject: Re: Cannot 'mount -o degraded /dev/replacement' after a replace
Date: Sat, 9 Feb 2019 20:16:12 +0800
Message-ID: <5441dc9d-a552-e77e-f74d-fe6ef702d400@gmx.com> (raw)
In-Reply-To: <2efee604-e44c-b00b-2ea8-d13ebc8c6355@gmail.com>

[-- Attachment #1.1: Type: text/plain, Size: 2817 bytes --]



On 2019/2/9 下午6:36, Jakob Schöttl wrote:
> Hi,
> 
> I've setup a RAID1 with two disks (disk1 and disk2) and I'm testing the
> btrfs replace command.
> 
> After replacing disk2 with disk3, I can only mount
> (a) disk1 or disk3 (if both disk are plugged) and
> (b) the original disk1 (degraded, if disk3 is unplugged).
> 
> I cannot mount the replacement disk3 if disk1 is unplugged.

Sounds like there is one single chunk on disk1, which caused the problem.

> 
>> mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop3,
> missing codepage or helper program, or other error.

dmesg please.

And btrfs-progs version please.

Maybe mkfs is too old to leave SINGLE profile chunks on the original fs.

And you could verify the chunk mapping by executing 'btrfs ins dump-tree
-t chunk <device>' and paste the output.

Thanks,
Qu

> 
> What I expect is that both disk1 and disk3 are fully valid and working
> after a replace.
> 
> Steps to reproduce:
> 
>   dd if=/dev/zero of=/vdisk1 bs=1024 count=300000
>   losetup /dev/loop1 /vdisk1
>   dd if=/dev/zero of=/vdisk2 bs=1024 count=300000
>   losetup /dev/loop2 /vdisk2
>   dd if=/dev/zero of=/vdisk3 bs=1024 count=300000
>   # losetup /dev/loop3 /vdisk3    # don't plug this device yet
> 
> Create RAID1 file system:
> 
>   mkfs.btrfs -L datavol -m raid1 -d raid1 /dev/loop1 /dev/loop2
> 
> Unplug device 2 to simulate a defect:
> 
>   losetup -d /dev/loop2
> 
> Plug device 3:
> 
>   losetup /dev/loop3 /vdisk3
> 
> Replace device 2 with device 3:
> 
>   mount -o degraded /dev/loop1 /mnt
>   btrfs filesystem show   # to get devid of device 2
>   btrfs replace start -Br 2 /dev/loop3 /mnt
>   btrfs replace status /mnt   # check success
>   umount /mnt
> 
> Unplug the original device 1 to see if device 3 has really replaced
> device 2:
> 
>   losetup -d /dev/loop1
>   mount -o degraded /dev/loop3 /mnt
> 
> The mount fails with this error:
> 
>> mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop3,
> missing codepage or helper program, or other error.
> 
> In this situation, btrfs device scan does not change anything and btrfs
> filesystem show shows:
> 
>> warning, device 1 is missing
>> warning, device 1 is missing
>> warning, device 1 is missing
>> warning, device 1 is missing
>> bad tree block 198180864, bytenr mismatch, want=198180864, have=0
>> ERROR: cannot read chunk root
>> Label: 'datavol'  uuid: 640e45d3-e741-4a78-a24e-2d8a41c6b8c3
>>     Total devices 2 FS bytes used 128.00KiB
>>     devid    2 size 292.97MiB used 104.00MiB path /dev/loop3
>>     *** Some devices missing
> 
> Is this a known problem? Can you reproduce it? Am I doing something wrong?
> 
> Regards, Jakob
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09 10:36 Jakob Schöttl
2019-02-09 12:16 ` Qu Wenruo [this message]
2019-02-09 13:45   ` Jakob Schöttl
2019-02-09 15:32     ` Andrei Borzenkov
2019-02-09 15:57       ` Jakob Schöttl
2019-02-09 15:36 ` Andrei Borzenkov
2019-02-10 18:44 ` Chris Murphy
2019-02-11  1:36   ` Qu Wenruo

Reply instructions:

You may reply publically 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=5441dc9d-a552-e77e-f74d-fe6ef702d400@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=jschoett@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org linux-btrfs@archiver.kernel.org
	public-inbox-index linux-btrfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox