Unable to mount btrfs filesystem “open_ctree failed”

btrfsmount

Having trouble mounting a btrfs filesystem. Originally created on a server running xbian. Trying to mount on an up-to-date OpenSUSE 42.2 server. Complains about unsupported feature 0x10, open_ctree failed.

How can I mount this filesystem ?

Mount attempt

# file -s /dev/sdc2
/dev/sdc2: BTRFS Filesystem (label "xbian", sectorsize 4096, nodesize 16384, leafsize 16384)
# mount -t btrfs /dev/sdc2 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sdc2,
       missing codepage or helper program, or other error

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

dmesg output

[  119.698406] BTRFS info (device sdc2): disk space caching is enabled
[  119.698409] BTRFS: couldn't mount because of unsupported optional features (10).
[  119.744887] BTRFS: open_ctree failed

btrfs version

# rpm -qa|grep btrfs
btrfsprogs-udev-rules-4.5.3-3.1.noarch
btrfsprogs-4.5.3-3.1.x86_64
libbtrfs0-4.5.3-3.1.x86_64
btrfsmaintenance-0.2-13.1.noarch
#

btrfs inspect-internal

Reports unknown flag. This behaviour seen on stock btrfs version supplied with OpenSUSE (btrfs-progs v4.5.3+20160729) and with latest when downloaded from git and compiled (btrfs-progs v4.9.1)

# btrfs inspect-internal dump-super /dev/sdc2
superblock: bytenr=65536, device=/dev/sdc2
---------------------------------------------------------
csum                    0x394d4988 [match]
bytenr                  65536
flags                   0x1
                        ( WRITTEN )
magic                   _BHRfS_M [match]
fsid                    71ecbcc5-c88f-4f27-b4d8-763bd801765e
label                   xbian
generation              129
root                    4669440
sys_array_size          97
chunk_root_generation   102
root_level              0
chunk_root              131072
chunk_root_level        0
log_root                0
log_root_transid        0
log_root_level          0
total_bytes             7451181056
bytes_used              691642368
sectorsize              4096
nodesize                16384
leafsize                16384
stripesize              4096
root_dir                6
num_devices             1
compat_flags            0x0
compat_ro_flags         0x0
incompat_flags          0x179
                        ( MIXED_BACKREF |
                          COMPRESS_LZO |
                          COMPRESS_LZOv2 |
                          BIG_METADATA |
                          EXTENDED_IREF |
                          SKINNY_METADATA |
                          unknown flag: 0x10 )
csum_type               0
csum_size               4
cache_generation        129
uuid_tree_generation    112
dev_item.uuid           a8b49751-56e3-4c42-a1d3-40a1554c800c
dev_item.fsid           71ecbcc5-c88f-4f27-b4d8-763bd801765e [match]
dev_item.type           0
dev_item.total_bytes    7451181056
dev_item.bytes_used     926941184
dev_item.io_align       4096
dev_item.io_width       4096
dev_item.sector_size    4096
dev_item.devid          1
dev_item.dev_group      0
dev_item.seek_speed     0
dev_item.bandwidth      0
dev_item.generation     0

#

Best Answer

The problem is indeed that the two Linux versions sport a slightly different BTRFS version, i.e. do not support the same features:

[ 119.698406] BTRFS info (device sdc2): disk space caching is enabled
[ 119.698409] BTRFS: couldn't mount because of unsupported optional features (10).

It seems that the xbian has enabled that features, while OpenSuse 42.2 does not, which prevents interoperability.

These FS features are optional: This means it is possible to create downward compatible BTRFS partitions on newer systems that are readable from older systems (without those features), controlled by the parameters that are passed to the mkfs.btrfs program.

The numeric code of the features is 10 - unknown flag: 0x10. I had a hard time to figure out what that codes means (my guess: extended inode references.) But since the number is so low, I think this is something basic. I think you cannot make this filesystem readable by unpatched kernels anymore. Otherwise, knowing the feature, we maybe could specify a mount option to avoid the error; like here, where the fs compression algorithm is specified:

mount -t btrfs -o compress=lz4 dev /mnt

If we do not know what this feature is you even cannot update your kernel in OpenSuse to match xbian. Usually in such a situation, you would rely on ext4 instead for compatibility reasons.

Related Question