btrfs unsupported optional features (10)

mkfs.btrfs -O list-alldoes not list optional features 0x10, and google does not return description of btrfs optional features (10), neither does brtfs wiki.

BTW, if your btrfs partition refuse to mount, run dmesg | grep BTRFSto find out error code.

Cause

It turns out optional features (10) means optional features 0x10, 0x10 = Hex 10 = 16 = 2^4 = 1UUL << 4, the corresponding feature is ZSTD compression. It is not supported, most likely, because your kernel version is below 4.14. Run uname -r to find your kernel version.

I am able to locate the error code 0x10 by looking at source code ctree.h "BTRFS_FEATURE_INCOMPAT" section. Try this method with other codes.

Code

Incompatible Feature

Kernel Version

Requirement

1

MIXED_BACKREF

?

2

DEFAULT_SUBVOL

?

4

MIXED_GROUPS

?

8

COMPRESS_LZO

2.6.38

10

COMPRESS_ZSTD

4.14

20

BIG_METADATA

3.4

40

EXTENDED_IREF

3.7

80

RAID56

3.9 (?)

100

SKINNY_METADATA

3.10

200

NO_HOLES

3.14

400

METADATA_UUID

5.0

800

RAID1C34

5.5

Solutions

Solution 1: Upgrade kernel to versions beyond 4.14.

Solution 2: Create a new partition without the incompatible features and copy data over. On another computer which is capable to mount the partition, use btrfs filesystem resize parted or Gparted to resize the original partition (btrfs only shrink filesystem but not partition, Gparted will shrink both; it is advised to shrink from the end of partiton just enough space for the migration of data, as it will save huge amount of time by not moving the start portion of an existing partition, as well as not moving extra null data when expanding an partition later), then use mkfs.btrfsor Gparted to create a new partition and use btrfs inspect-internal dump-super to check all activated features, and finally mount without compress=zstd option and move data to the new partition (then delete original partition and resize new partition).

Solution 3: (Require programing or code modification skills.) On another computer which is capable to mount the partition, use brtfs defragmentation tool to convert all files to the basic zlib or lzo compression. Example command: btrfs filesystem defrag -r -clzo /media/sda1 Note that -clzo dictates the use of lzo algorithm, if you want to use zlib or if -clzo is not suppoted, simply switch to -c to dictate zlib algorithm. After that, all data in the filesystem is zstd free; however, the kernel does not remove the zstd flag automatically. Therefore, you will have to remove the flag manually. Unfortunately, there is no standard tool to remove this particular flag, so you will have to patch the brtfstune tool (source codbtrfstune.c) and compile it yourself. A dirty way to do it would be changing super_flags |= flags to super_flags = flags - super_flags in the static int set_super_incompat_flags( ) section and replace one of the command parameter, for example: change case 'x': super_flags |= BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA; to case 'x': super_flags |= BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD; Thus, you should be able to remove the zstd flag by btrfstune -x /dev/your_device_for_example_sdc1 Please note that I have not tried this method myself. This method is based on my understanding of the btrfs filesystem and the btrfs_prog tool. I assume it would be helpfully to someone who wants to keep the original partition and/or who does not want to move the data; however, use it at your own risk.

Last updated