I’m unable to mount a btrfs partition

btrfs

I had a raid 5 array of 3 disks using btrfs (raid provided by btrfs) one of the disks was damaged and I replaced the disk via:

btrfs device add /dev/sdc /media/raid/ 
btrfs device delete missing /media/raid/ 

which forced a rebalance accross the disks, after which the FS was fine.

One reboot later:

[11152.188020] BTRFS info (device sdb): enabling auto defrag 
[11152.188028] BTRFS info (device sdb): disk space caching is enabled 
[11152.189762] BTRFS: failed to read chunk tree on sdb 
[11152.196224] BTRFS: open_ctree failed 

pc ~ # mount -a 
mount: wrong fs type, bad option, bad superblock on /dev/sde, 
missing codepage or helper program, or other error 

In some cases useful info is found in syslog – try
dmesg | tail or so.

The OS started by commenting out that line in fstab, I've uncommented that line afterwards.

LABEL="raid" /media/raid btrfs compress=lzo,noatime,autodefrag

I'm using Gentoo Linux, kernel 4.0.5.

Here's btrfs fi show:

Label: 'raid'  uuid: 906ed4e3-52c5-4eb7-bd06-4810c0b84902
Total devices 3 FS bytes used 775.29GiB
devid    1 size 931.51GiB used 390.06GiB path /dev/sdb
devid    3 size 931.51GiB used 390.04GiB path /dev/sde
devid    4 size 931.51GiB used 390.03GiB path /dev/sdc


pc / # btrfs-find-root /dev/sdc
Superblock thinks the generation is 1758
Superblock thinks the level is 0
Found tree root at 30818304 gen 1758 level 0
Well block 30457856(gen: 1757 level: 0) seems good, but generation/level doesn't match, want gen: 1758 level: 0
Well block 29753344(gen: 1590 level: 0) seems good, but generation/level doesn't match, want gen: 1758 level: 0
Well block 29507584(gen: 1589 level: 0) seems good, but generation/level doesn't match, want gen: 1758 level: 0
Well block 4243456(gen: 3 level: 0) seems good, but generation/level doesn't match, want gen: 1758 level: 0
Well block 4194304(gen: 2 level: 0) seems good, but generation/level doesn't match, want gen: 1758 level: 0

Best Answer

Did you try to mount the volume with the recovery option?

From man mount:

recovery : Enable autorecovery attempts if a bad tree root is found at mount time. Currently this scans a list of several previous tree roots and tries to use the first readable.

mount -o recovery /dev/sdb /media/raid

Related Question