Cannot 'mount -o degraded /dev/replacement' after a replace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux