Linux-BTRFS Archive on lore.kernel.org
 help / Atom feed
From: "Jakob Schöttl" <jschoett@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Cannot 'mount -o degraded /dev/replacement' after a replace
Date: Sat, 9 Feb 2019 11:36:01 +0100
Message-ID: <2efee604-e44c-b00b-2ea8-d13ebc8c6355@gmail.com> (raw)

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.

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

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


             reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09 10:36 Jakob Schöttl [this message]
2019-02-09 12:16 ` Qu Wenruo
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=2efee604-e44c-b00b-2ea8-d13ebc8c6355@gmail.com \
    --to=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