* btrfs: multi-device pool corrupted after repeated removal/recreation of missing device
[not found] <JJ5S5tQDVkTmHxqx0ncj423p-TgogJGM8fSviYuGeF1i-xc7NtTdlmd1VO0aopC3SEVqYZF_Z6opVqrTz4eJ8sbDOiceQNzgwnjerSXJWhM=@proton.me>
@ 2026-05-30 20:25 ` xerobrinhek
2026-05-30 22:55 ` Roman Mamedov
0 siblings, 1 reply; 2+ messages in thread
From: xerobrinhek @ 2026-05-30 20:25 UTC (permalink / raw)
To: linux-btrfs
Hello btrfs developers,
I have a btrfs multi-device setup that got corrupted after a failed device removal. I need help recovering the filesystem structure (not just raw file extraction).
Setup:
- Two devices: nvme0n1p9 (17.53GB) and nvme0n1p8 (31,30GB) originally
- The filesystem uses subvolumes: @, @home, @var, @snapshots
- Compression: enabled (zstd)
What happened:
1. I removed /dev/nvme0n1p8 (devid 2) from the pool without proper 'btrfs device remove'
2. I tried to recreate the missing device multiple times, creating and removing btrfs on it
3. Now the filesystem won't mount at all
Current symptoms:
Mount attempt:
# mount -t btrfs -o degraded,ro,rescue=all /dev/nvme0n1p9 /mnt
mount: /mnt: can't read superblock on /dev/nvme0n1p9.
dmesg shows:
[ 688.380328] BTRFS warning: 'usebackuproot' is deprecated, use 'rescue=usebackuproot' instead
[ 688.385530] BTRFS info (device nvme0n1p9): first mount of filesystem 0d554048-1a10-4fbe-9d7d-80de9d3f0700
[ 688.385538] BTRFS info (device nvme0n1p9): using crc32c checksum algorithm
[ 688.386981] BTRFS warning (device nvme0n1p9): devid 2 uuid a8559fa6-e465-459f-ac73-86c842aa6fe0 is missing
[ 688.388044] BTRFS warning (device nvme0n1p9): failed to read root (objectid=4): -5
[ 688.388060] BTRFS warning (device nvme0n1p9): try to load backup roots slot 1
[ 688.388425] BTRFS warning (device nvme0n1p9): global root 2 0 already exists
[ 688.388433] BTRFS error (device nvme0n1p9): failed to load root extent
[ 688.388440] BTRFS warning (device nvme0n1p9): try to load backup roots slot 2
[ 688.388498] BTRFS warning (device nvme0n1p9): couldn't read tree root
[ 688.388505] BTRFS warning (device nvme0n1p9): try to load backup roots slot 3
[ 688.388773] BTRFS warning (device nvme0n1p9): global root 2 0 already exists
[ 688.388776] BTRFS error (device nvme0n1p9): failed to load root extent
[ 688.389043] BTRFS error (device nvme0n1p9): open_ctree failed: -17
What I tried (all from Fedora Live USB):
1. Superblock recovery:
# btrfs rescue super-recover -v /dev/nvme0n1p9
All supers are valid, no need to recover
2. Zero log:
# btrfs rescue zero-log /dev/nvme0n1p9
Couldn't setup device tree
ERROR: could not open ctree
3. Chunk recover on both devices:
# btrfs rescue chunk-recover -y -v /dev/nvme0n1p8
Result: Chunk tree recovered successfully (generation 9, chunk root gen 😎
# btrfs rescue chunk-recover -y -v /dev/nvme0n1p9
Result: Chunk tree recovery failed (the device is the main one with data)
4. Mount with various options all fail with either "can't read superblock" or "FS exist" error:
- degraded,ro,subvol=@
- degraded,ro,rescue=all
- degraded,ro,usebackuproot
- degraded,ro,sb=1 (parameter unknown)
Key observation:
btrfs-find-root shows there are valid roots at various addresses, but mounting fails with EEXIST (-17) and "global root 2 0 already exists" errors.
Questions:
1. Is there any way to force the filesystem to forget about missing devid 2 and mount using only nvme0n1p9?
2. Can I manually copy the chunk tree from p8 to p9 using dd at specific offsets?
3. What would be the correct procedure to rebuild the extent tree and root tree without losing subvolume structure?
4. Is --init-extent-tree a viable option at this stage?
I understand the risk of data loss. My goal is to restore the filesystem structure (subvolumes, names, directory hierarchy), not just raw file extraction.
Thank you for your time.
^ permalink raw reply [flat|nested] 2+ messages in thread