invalid root flags, have 0x400000000 expect mask 0x1000000000001

Asked by geole0

Good morning.
Following a failure of a synoligy NAS, the three disks have been removed and are in the tower of an ubuntu computer. The BTRFS raid is well recognized. But the mount command refuses to mount it with the referenced message.
This in ubuntu 18.04 and ubuntu 22.04 version.

I have four questions.
1) Is it possible to find a document that explains, in human language, the meaning of 0x400000000 and 0x100000000000.
I searched without finding. I saw a track referring to subvolumes (https://www.reddit.com/r/synology/comments/u6y5qm/has_anyone_found_a_solution_for_mounting_synology/)

2) The mount command has plenty of options, I couldn't find one to override. Did I search wrong?

3) I wanted to repair with the command
btrfsck (see attached file)
I probably misused the options.
I don't know if using these two options would be helpful
--init-csum-tree
--init-extent-tree

4) I hesitate to install an old version of ubuntu 14.04 or 16.04 because I fear that the mount command will start to loop instead of indicating an error or actually doing the mounting.

Thank you for your review and have a nice day.

==========================================================================
===> Extract of journalctl when mounting is asked

juin 01 00:15:21 jeanyves-HP-Compaq-6005-Pro-MT-PC kernel: BTRFS: device label 2021.01.13-18:19:28 v25426 devid 1 transid 2952074 /dev/md2 scanned by mount (11373)
juin 01 00:15:21 jeanyves-HP-Compaq-6005-Pro-MT-PC kernel: BTRFS info (device md2): using free space tree
juin 01 00:15:21 jeanyves-HP-Compaq-6005-Pro-MT-PC kernel: BTRFS info (device md2): has skinny extents
juin 01 00:15:21 jeanyves-HP-Compaq-6005-Pro-MT-PC kernel: BTRFS critical (device md2): corrupt leaf: root=1 block=77758464 slot=0, invalid root flags, have 0x400000000 expect mask 0x1000000000001
juin 01 00:15:21 jeanyves-HP-Compaq-6005-Pro-MT-PC kernel: BTRFS error (device md2): block=77758464 read time tree block corruption detected
juin 01 00:15:21 jeanyves-HP-Compaq-6005-Pro-MT-PC kernel: BTRFS critical (device md2): corrupt leaf: root=1 block=77758464 slot=0, invalid root flags, have 0x400000000 expect mask 0x1000000000001
juin 01 00:15:21 jeanyves-HP-Compaq-6005-Pro-MT-PC kernel: BTRFS error (device md2): block=77758464 read time tree block corruption detected
juin 01 00:15:21 jeanyves-HP-Compaq-6005-Pro-MT-PC kernel: BTRFS error (device md2): open_ctree failed

====> The return of the first repair command
sudo btrfsck -s 1 --check-data-csum --repair --progress /dev/md2
using SB copy 1, bytenr 67108864
enabling repair mode
WARNING:

 Do not use --repair unless you are advised to do so by a developer
 or an experienced user, and then only after having accepted that no
 fsck can successfully repair all types of filesystem corruption. Eg.
 some software or hardware bugs can fatally damage a volume.
 The operation will start in 10 seconds.
 Use Ctrl-C to stop it.
10 9 8 7 6 5 4 3 2 1
Starting repair.
Opening filesystem to check...
Checking filesystem on /dev/md2
UUID: ff6851ee-a74e-4839-a08b-31bf0c91f44f
[1/7] checking root items (0:00:02 elapsed, 84719 items checked)
Fixed 0 roots.
Invalid key type(BLOCK_GROUP_ITEM) found in root(202)00 elapsed, 26 items checked)
ignoring invalid key
Invalid key type(BLOCK_GROUP_ITEM) found in root(202)
ignoring invalid key
Invalid key type(BLOCK_GROUP_ITEM) found in root(202)
ignoring invalid key
Invalid key type(BLOCK_GROUP_ITEM) found in root(202)
ignoring invalid key
Invalid key type(BLOCK_GROUP_ITEM) found in root(202)
ignoring invalid key
Invalid key type(BLOCK_GROUP_ITEM) found in root(202)
...
...
...
Invalid key type(BLOCK_GROUP_ITEM) found in root(202)
ignoring invalid key
super bytes used 3524243456 mismatches actual used 3524210688ed, 2847 items checked)
Invalid key type(BLOCK_GROUP_ITEM) found in root(202)
ignoring invalid key
...
...
Invalid key type(BLOCK_GROUP_ITEM) found in root(202)
ignoring invalid key
No device size related problem found (0:00:07 elapsed, 5461 items checked)
[2/7] checking extents (0:00:07 elapsed, 5696 items checked)
[3/7] checking free space tree (0:00:00 elapsed, 328 items checked)
[4/7] checking fs roots (0:00:01 elapsed, 1914 items checked)
[5/7] checking csums against data (0:00:05 elapsed, 4453 items checked)
[6/7] checking root refs (0:00:00 elapsed, 124 items checked)
[7/7] checking quota groups skipped (not enabled on this FS)
found 7048454144 bytes used, no error found
total csum bytes: 2311576
total tree bytes: 88965120
total fs tree bytes: 63143936
total extent tree bytes: 17842176
btree space waste bytes: 23227198
file data blocks allocated: 17847271424
 referenced 14762950656

====> The return of the second repair command
sudo btrfsck -s 1 --tree-root 202 --repair --progress /dev/md2
using SB copy 1, bytenr 67108864
enabling repair mode
WARNING:

 Do not use --repair unless you are advised to do so by a developer
 or an experienced user, and then only after having accepted that no
 fsck can successfully repair all types of filesystem corruption. Eg.
 some software or hardware bugs can fatally damage a volume.
 The operation will start in 10 seconds.
 Use Ctrl-C to stop it.
10 9 8 7 6 5 4 3 2 1
Starting repair.
Opening filesystem to check...
ERROR: tree block bytenr 202 is not aligned to sectorsize 4096
Couldn't read tree root
ERROR: cannot open file system

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

Maybe you get some more information with diagnostic commands like

btrfs inspect dump-super -f /dev/md2

Revision history for this message
Bernard Stafford (bernard010) said :
#2
Revision history for this message
geole0 (geole0) said :
#3

This is result of inspect.

btrfs inspect dump-super -f /dev/md2
superblock: bytenr=65536, device=/dev/md2
---------------------------------------------------------
csum_type 0 (crc32c)
csum_size 4
csum 0xb133000b [match]
bytenr 65536
flags 0x1
   ( WRITTEN )
magic _BHRfS_M [match]
fsid ff6851ee-a74e-4839-a08b-31bf0c91f44f
metadata_uuid ff6851ee-a74e-4839-a08b-31bf0c91f44f
label 2021.01.13-18:19:28 v25426
generation 2952074
root 29360128
sys_array_size 258
chunk_root_generation 2941220
root_level 1
chunk_root 5710859468800
chunk_root_level 1
log_root 0
log_root_transid 0
log_root_level 0
total_bytes 5991310426112
bytes_used 3524243456
sectorsize 4096
nodesize 16384
leafsize (deprecated) 16384
stripesize 4096
root_dir 6
num_devices 1
compat_flags 0x8000000000000000
compat_ro_flags 0x3
   ( FREE_SPACE_TREE |
     FREE_SPACE_TREE_VALID )
incompat_flags 0x16b
   ( MIXED_BACKREF |
     DEFAULT_SUBVOL |
     COMPRESS_LZO |
     BIG_METADATA |
     EXTENDED_IREF |
     SKINNY_METADATA )
cache_generation 18446744073709551615
uuid_tree_generation 2952071
dev_item.uuid 59eb5676-090c-479d-9ddf-be0c24bc53fe
dev_item.fsid ff6851ee-a74e-4839-a08b-31bf0c91f44f [match]
dev_item.type 0
dev_item.total_bytes 5991310426112
dev_item.bytes_used 2911048302592
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
sys_chunk_array[2048]:
 item 0 key (FIRST_CHUNK_TREE CHUNK_ITEM 1955883646976)
  length 33554432 owner 2 stripe_len 65536 type SYSTEM|DUP
  io_align 65536 io_width 65536 sector_size 4096
  num_stripes 2 sub_stripes 1
   stripe 0 devid 1 offset 89225428992
   dev_uuid 59eb5676-090c-479d-9ddf-be0c24bc53fe
   stripe 1 devid 1 offset 89258983424
   dev_uuid 59eb5676-090c-479d-9ddf-be0c24bc53fe
 item 1 key (FIRST_CHUNK_TREE CHUNK_ITEM 5710859468800)
  length 33554432 owner 2 stripe_len 65536 type SYSTEM|DUP
  io_align 65536 io_width 65536 sector_size 4096
  num_stripes 2 sub_stripes 1
   stripe 0 devid 1 offset 12922650624
   dev_uuid 59eb5676-090c-479d-9ddf-be0c24bc53fe
   stripe 1 devid 1 offset 12956205056
   dev_uuid 59eb5676-090c-479d-9ddf-be0c24bc53fe
backup_roots[4]:
 backup 0:
  backup_tree_root: 29360128 gen: 2952072 level: 1
  backup_chunk_root: 5710859468800 gen: 2941220 level: 1
  backup_extent_root: 29376512 gen: 2952072 level: 2
  backup_fs_root: 29687808 gen: 8 level: 0
  backup_dev_root: 29573120 gen: 2950326 level: 1
  backup_csum_root: 144490496 gen: 2952070 level: 1
  backup_total_bytes: 5991310426112
  backup_bytes_used: 3524243456
  backup_num_devices: 1

 backup 1:
  backup_tree_root: 29458432 gen: 2952073 level: 1
  backup_chunk_root: 5710859468800 gen: 2941220 level: 1
  backup_extent_root: 29622272 gen: 2952073 level: 2
  backup_fs_root: 29687808 gen: 8 level: 0
  backup_dev_root: 29573120 gen: 2950326 level: 1
  backup_csum_root: 144490496 gen: 2952070 level: 1
  backup_total_bytes: 5991310426112
  backup_bytes_used: 3524243456
  backup_num_devices: 1

 backup 2:
  backup_tree_root: 29360128 gen: 2952074 level: 1
  backup_chunk_root: 5710859468800 gen: 2941220 level: 1
  backup_extent_root: 29376512 gen: 2952074 level: 2
  backup_fs_root: 29687808 gen: 8 level: 0
  backup_dev_root: 29573120 gen: 2950326 level: 1
  backup_csum_root: 144490496 gen: 2952070 level: 1
  backup_total_bytes: 5991310426112
  backup_bytes_used: 3524243456
  backup_num_devices: 1

 backup 3:
  backup_tree_root: 145326080 gen: 2952071 level: 1
  backup_chunk_root: 5710859468800 gen: 2941220 level: 1
  backup_extent_root: 145342464 gen: 2952071 level: 2
  backup_fs_root: 29687808 gen: 8 level: 0
  backup_dev_root: 29573120 gen: 2950326 level: 1
  backup_csum_root: 144490496 gen: 2952070 level: 1
  backup_total_bytes: 5991310426112
  backup_bytes_used: 3524210688
  backup_num_devices: 1
---------------------

Revision history for this message
geole0 (geole0) said :
#4

Good morning.
I didn't quite understand the "miraculous" option to be used by the /etc/fstab mount
So I proposed as usual with a test request before the machine shutdown.
- line added in the file /etc/fstab
/dev/md2 /media/bug btrfs defaults 0 0
 The test
sudo mkdir -v /media/bug
sudo mount -av
   The résult
root@jeanyves-HP-Compaq-6005-Pro-MT-PC:~# sudo mount -av
/ : ignoré
/boot/efi : déjà monté
none : ignoré
mount: /media/bug: wrong fs type, bad option, bad superblock on /dev/md2, missing codepage or helper program, or other error.
root@jeanyves-HP-Compaq-6005-Pro-MT-PC

Unsurprisingly, the boot crashed. So I added the nofail option.
However, mounting the partition remains impossible.

Revision history for this message
yansorau (yansorau) said :
#5

Can you help with this problem?

Provide an answer of your own, or ask geole0 for more information if necessary.

To post a message you must log in.