linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cannot 'mount -o degraded /dev/replacement' after a replace
@ 2019-02-09 10:36 Jakob Schöttl
  2019-02-09 12:16 ` Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jakob Schöttl @ 2019-02-09 10:36 UTC (permalink / raw)
  To: linux-btrfs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-02-11  1:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-09 10:36 Cannot 'mount -o degraded /dev/replacement' after a replace Jakob Schöttl
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

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).