# Montage btrfs/raid

**URL:** <https://www.debian-fr.org/t/montage-btrfs-raid/82699>\
**Category:** Support Debian\
**Created:** [Août 26, 2020, 3:01 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699 "2020-08-26T15:01:49Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![vlotho](https://www.debian-fr.org/user_avatar/www.debian-fr.org/vlotho/32/2963_2.png) [@vlotho](https://www.debian-fr.org/u/vlotho)\
**Post date:** [Août 26, 2020, 3:01 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/1 "2020-08-26T15:01:50Z")

</div>

Salut,  
j’ai un nas qui ne démarre plus, je vais surement réinstaller le système dessus mais il faut que je mette ce qu’il y a dessus en sécurité.  
C’est un RAID 6 de 4 disques avec un système de fichier BTRFS.  
La partition est bien visible dans gparted (j’ai démarré avec un kali live) mais je ne parviens pas à la monter (la partition est assemblé en /dev/md2).  
j’ai testé avec un mount -t btrfs /dev/md2 ~/Desktop/NAS mais il me répond mauvais fs type ou options ou superblock …

Y aurait t-il peut être d’autre options à passer ou une autre façon de faire je ne sais pas trop …

---

<div class="post-metadata">

**Author:** ![PascalHambourg](https://www.debian-fr.org/user_avatar/www.debian-fr.org/pascalhambourg/32/5837_2.png) [@PascalHambourg](https://www.debian-fr.org/u/PascalHambourg)\
**Post date:** [Août 27, 2020, 10:23 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/2 "2020-08-27T10:23:57Z")

</div>

Que disent les messages du noyau immédiatement après la tentative de montage ?

```
dmesg | tail -n 20

```

Est-ce que l’ensemble RAID est bien actif ?

```
cat /proc/mdstat
mdadm --detail /dev/md2

```

Est-ce que le contenu est bien vu comme btrfs ?

```
blkid /dev/md2

```

Es-ce que la vérification du système de fichiers passe ?

```
btrfs check /dev/md2
```

---

<div class="post-metadata">

**Author:** ![vlotho](https://www.debian-fr.org/user_avatar/www.debian-fr.org/vlotho/32/2963_2.png) [@vlotho](https://www.debian-fr.org/u/vlotho)\
**Post date:** [Août 27, 2020, 11:27 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/3 "2020-08-27T11:27:45Z")

</div>

```
kali@kali:~$ sudo dmesg | grep md2
[1290.903057] md: md2 stopped.
[1291.544841] md/raid:md2: device sda3 operational as raid disk 0
[1291.544848] md/raid:md2: device sdd3 operational as raid disk 3
[1291.544851] md/raid:md2: device sdc3 operational as raid disk 2
[1291.544853] md/raid:md2: device sdb3 operational as raid disk 1
[1291.545832] md/raid:md2: raid level 6 active with 4 out of 4 devices, algorithm 2
[1291.545886] md2: detected capacity change from 0 to 1990534234112
[1291.972857] BTRFS: device label 2020.02.10-09:18:07 v15284 devid 1 transid 119291 /dev/md2 scanned by systemd-udevd (28657)
[1322.971326] BTRFS info (device md2): disk space caching is enabled
[1322.971334] BTRFS info (device md2): has skinny extents
[1323.020810] BTRFS critical (device md2): corrupt leaf: root=1 block=741489180672 slot=0, invalid root flags, have 0x200000000 expect mask 0x1000000000001
[1323.020822] BTRFS error (device md2): block=741489180672 read time tree block corruption detected
[1323.025524] BTRFS critical (device md2): corrupt leaf: root=1 block=741489180672 slot=0, invalid root flags, have 0x200000000 expect mask 0x1000000000001
[1323.025537] BTRFS error (device md2): block=741489180672 read time tree block corruption detected
[1323.040555] BTRFS error (device md2): open_ctree failed
[1499.897918] BTRFS info (device md2): disk space caching is enabled
[1499.897926] BTRFS info (device md2): has skinny extents
[1499.923587] BTRFS critical (device md2): corrupt leaf: root=1 block=741489180672 slot=0, invalid root flags, have 0x200000000 expect mask 0x1000000000001
[1499.923598] BTRFS error (device md2): block=741489180672 read time tree block corruption detected
[1499.923938] BTRFS critical (device md2): corrupt leaf: root=1 block=741489180672 slot=0, invalid root flags, have 0x200000000 expect mask 0x1000000000001
[1499.923946] BTRFS error (device md2): block=741489180672 read time tree block corruption detected
[1499.944869] BTRFS error (device md2): open_ctree failed
[1523.434029] BTRFS info (device md2): disk space caching is enabled
[1523.434038] BTRFS info (device md2): has skinny extents
[1523.439662] BTRFS critical (device md2): corrupt leaf: root=1 block=741489180672 slot=0, invalid root flags, have 0x200000000 expect mask 0x1000000000001
[1523.439670] BTRFS error (device md2): block=741489180672 read time tree block corruption detected
[1523.440495] BTRFS critical (device md2): corrupt leaf: root=1 block=741489180672 slot=0, invalid root flags, have 0x200000000 expect mask 0x1000000000001
[1523.440501] BTRFS error (device md2): block=741489180672 read time tree block corruption detected
[1523.456638] BTRFS error (device md2): open_ctree failed
[2987.597454] BTRFS info (device md2): disk space caching is enabled
[2987.597461] BTRFS info (device md2): has skinny extents
[2987.612990] BTRFS critical (device md2): corrupt leaf: root=1 block=741489180672 slot=0, invalid root flags, have 0x200000000 expect mask 0x1000000000001
[2987.613000] BTRFS error (device md2): block=741489180672 read time tree block corruption detected
[2987.613182] BTRFS critical (device md2): corrupt leaf: root=1 block=741489180672 slot=0, invalid root flags, have 0x200000000 expect mask 0x1000000000001
[2987.613186] BTRFS error (device md2): block=741489180672 read time tree block corruption detected
[2987.632728] BTRFS error (device md2): open_ctree failed

kali@kali:~$ cat /proc/mdstat 
Personalities : [raid6] [raid5] [raid4] 
md2 : active (auto-read-only) raid6 sda3[0] sdd3[3] sdc3[2] sdb3[1]
      1943881088 blocks super 1.2 level 6, 64k chunk, algorithm 2 [4/4] [UUUU]
      
unused devices: <none>

kali@kali:~$ sudo mdadm --detail /dev/md2
/dev/md2:
           Version : 1.2
     Creation Time : Mon Feb 10 09:16:31 2020
        Raid Level : raid6
        Array Size : 1943881088 (1853.83 GiB 1990.53 GB)
     Used Dev Size : 971940544 (926.91 GiB 995.27 GB)
      Raid Devices : 4
     Total Devices : 4
       Persistence : Superblock is persistent

       Update Time : Tue Aug 18 23:15:29 2020
             State : clean 
    Active Devices : 4
   Working Devices : 4
    Failed Devices : 0
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 64K

Consistency Policy : resync

              Name : ServeurNAS:2
              UUID : d0116ba2:3a85f12d:b5e4d317:e19e1e78
            Events : 187

    Number Major Minor RaidDevice State
       0 8 3 0 active sync /dev/sda3
       1 8 19 1 active sync /dev/sdb3
       2 8 35 2 active sync /dev/sdc3
       3 8 51 3 active sync /dev/sdd3

kali@kali:~$ blkid /dev/md2
/dev/md2: LABEL="2020.02.10-09:18:07 v15284" UUID="94aaf002-efbb-4943-b253-8b3f99d5a298" UUID_SUB="5d419294-3aae-4c3c-af74-09247e3e1520" BLOCK_SIZE="4096" TYPE="btrfs"

```

J’ai cherché un petit moment mais btrfs-check est déprécié et il a été remplacé par btrfsck 🙂 mais oui elle passe sans erreur et j’ai retesté un :  
kali@kali:~$ sudo mount -t btrfs /dev/md2 ~/Desktop/NAS  
mount: /home/kali/Desktop/NAS: wrong fs type, bad option, bad superblock on /dev/md2, missing codepage or helper program, or other error.

---

<div class="post-metadata">

**Author:** ![PascalHambourg](https://www.debian-fr.org/user_avatar/www.debian-fr.org/pascalhambourg/32/5837_2.png) [@PascalHambourg](https://www.debian-fr.org/u/PascalHambourg)\
**Post date:** [Août 27, 2020, 12:11 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/4 "2020-08-27T12:11:00Z")

</div>

> [@vlotho](#):
>
> mais btrfs-check est déprécié et il a été remplacé par btrfsck

Non, en fait btrfs-check est le nom de la page de manuel, la commande est «&nbsp;btrfs check&nbsp;», dont btrfsck est un alias.

> [@vlotho](#):
>
> elle passe sans erreur

D’après ses logs, le noyau n’est pas du même avis. Est-ce que la version du noyau actuel est supérieure ou égale à celle du système d’origine ?

---

<div class="post-metadata">

**Author:** ![vlotho](https://www.debian-fr.org/user_avatar/www.debian-fr.org/vlotho/32/2963_2.png) [@vlotho](https://www.debian-fr.org/u/vlotho)\
**Post date:** [Août 27, 2020, 12:19 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/5 "2020-08-27T12:19:38Z")

</div>

Je pense que le système d’origine a un version du noyaux inférieure à celle de kali.  
je n’ai plus accès au système mais généralement les nas ont toujours des noyaux plus anciens.  
c’est pas des systèmes rolling 😃  
je sais pas … à ton avis c’est possible de le récupérer ? peut être en trouvant un système avec un noyaux identique

c’est un 5.7 sur kali

---

<div class="post-metadata">

**Author:** ![PascalHambourg](https://www.debian-fr.org/user_avatar/www.debian-fr.org/pascalhambourg/32/5837_2.png) [@PascalHambourg](https://www.debian-fr.org/u/PascalHambourg)\
**Post date:** [Août 27, 2020, 1:07 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/6 "2020-08-27T13:07:24Z")

</div>

Quel est le système d’origine du NAS ?

---

<div class="post-metadata">

**Author:** ![vlotho](https://www.debian-fr.org/user_avatar/www.debian-fr.org/vlotho/32/2963_2.png) [@vlotho](https://www.debian-fr.org/u/vlotho)\
**Post date:** [Août 27, 2020, 3:27 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/7 "2020-08-27T15:27:07Z")

</div>

C’est DSM de Synology

---

<div class="post-metadata">

**Author:** ![PascalHambourg](https://www.debian-fr.org/user_avatar/www.debian-fr.org/pascalhambourg/32/5837_2.png) [@PascalHambourg](https://www.debian-fr.org/u/PascalHambourg)\
**Post date:** [Août 27, 2020, 4:04 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/8 "2020-08-27T16:04:12Z")

</div>

Si c’est l’OS du constructeur du NAS, il peut inclure des modifications propriétaires utilisant un format non standard de Btrfs. J’ai déjà vu ça avec des formats de RAID spécifiques.

Si c’est du Btrfs standard, je ne vois pas quoi faire d’autre que forcer une réparation avec `btrfsck --repair`. Mais je connais pas très bien Btrfs.

---

<div class="post-metadata">

**Author:** ![vlotho](https://www.debian-fr.org/user_avatar/www.debian-fr.org/vlotho/32/2963_2.png) [@vlotho](https://www.debian-fr.org/u/vlotho)\
**Post date:** [Août 27, 2020, 6:32 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/9 "2020-08-27T18:32:22Z")

</div>

```
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)
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
No device size related problem found
[3/7] checking free space cache
cache and super generation don't match, space cache will be invalidated
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 702099886080 bytes used, no error found
total csum bytes: 99275204
total tree bytes: 773095424
total fs tree bytes: 629047296
total extent tree bytes: 37650432
btree space waste bytes: 116565562
file data blocks allocated: 702012858368
 referenced 701268541440
kali@kali:~$ sudo mount -t btrfs /dev/md2 ~/Desktop/NAS
mount: /home/kali/Desktop/NAS: wrong fs type, bad option, bad superblock on /dev/md2, missing codepage or helper program, or other error.

```

toujours rien …

---

<div class="post-metadata">

**Author:** ![PascalHambourg](https://www.debian-fr.org/user_avatar/www.debian-fr.org/pascalhambourg/32/5837_2.png) [@PascalHambourg](https://www.debian-fr.org/u/PascalHambourg)\
**Post date:** [Août 30, 2020, 9:51 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/10 "2020-08-30T09:51:14Z")

</div>

Il faudrait un bon connaisseur de btrfs, ce que je ne suis pas, pour décoder tout ça.

Sinon regarde du côté de `btrfs restore` pour essayer de récupérer le contenu du système de fichiers sans le monter.

```
man btrfs-restore

```

[https://btrfs.wiki.kernel.org/index.php/Restore](https://btrfs.wiki.kernel.org/index.php/Restore)

---

<div class="post-metadata">

**Author:** ![vlotho](https://www.debian-fr.org/user_avatar/www.debian-fr.org/vlotho/32/2963_2.png) [@vlotho](https://www.debian-fr.org/u/vlotho)\
**Post date:** [Août 30, 2020, 10:16 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/11 "2020-08-30T10:16:50Z")

</div>

Merci Pascal je vais peut être essayer de poster sur un forum dédié à btrfs, ça doit surement exister ! 😃

---

<div class="post-metadata">

**Author:** ![vlotho](https://www.debian-fr.org/user_avatar/www.debian-fr.org/vlotho/32/2963_2.png) [@vlotho](https://www.debian-fr.org/u/vlotho)\
**Post date:** [Août 30, 2020, 10:35 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/12 "2020-08-30T10:35:56Z")

</div>

il y a pas foule sur leur IRC …

---

<div class="post-metadata">

**Author:** ![PascalHambourg](https://www.debian-fr.org/user_avatar/www.debian-fr.org/pascalhambourg/32/5837_2.png) [@PascalHambourg](https://www.debian-fr.org/u/PascalHambourg)\
**Post date:** [Août 30, 2020, 10:49 UTC](https://www.debian-fr.org/t/montage-btrfs-raid/82699/13 "2020-08-30T10:49:47Z")

</div>

Faut dire que c’est dimanche…
