public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* dev extent physical offset [...] on devid 1 doesn't have corresponding chunk
@ 2024-12-14  2:17 Ben Millwood
  2024-12-14  2:51 ` Qu Wenruo
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Millwood @ 2024-12-14  2:17 UTC (permalink / raw)
  To: linux-btrfs

Hi folks,

I encountered this error recently, and I can't find it anywhere on
Google except in the patches that first added the check, so I come to
you for guidance.

This is one of my removable USB drives, formatted btrfs and primarily
for the purpose of receiving snapshots from my laptop's root drive.
I'm running:

$ mount /dev/masterchef-vg/btrfs /mnt/masterchef/btrfs -o compress
mount: /mnt/masterchef/btrfs: mount(2) system call failed: Structure
needs cleaning.
       dmesg(1) may have more information after failed mount system call.

Here's what dmesg says:

[13570.361767] BTRFS info (device dm-4): first mount of filesystem
a0ed3709-1490-4f2d-96b5-bb1fb22f0b45
[13570.361779] BTRFS info (device dm-4): using crc32c (crc32c-intel)
checksum algorithm
[13570.361783] BTRFS info (device dm-4): use zlib compression, level 3
[13570.361785] BTRFS info (device dm-4): disk space caching is enabled
[13570.374442] BTRFS error (device dm-4): dev extent physical offset
1997265698816 on devid 1 doesn't have corresponding chunk
[13570.374448] BTRFS error (device dm-4): failed to verify dev extents
against chunks: -117
[13570.375329] BTRFS error (device dm-4): open_ctree failed

This issue emerged around the time I was trying to mount this
filesystem from my Raspberry Pi for the first time, but now occurs on
both my own laptop and my rpi.

Here's my laptop's details:

$ uname -a
Linux noether 6.6.63 #1-NixOS SMP PREEMPT_DYNAMIC Fri Nov 22 14:38:37
UTC 2024 x86_64 GNU/Linux

$ btrfs --version
btrfs-progs v6.11
-EXPERIMENTAL -INJECT -STATIC +LZO +ZSTD +UDEV +FSVERITY +ZONED CRYPTO=builtin

$ btrfs fi show
Label: 'noether-root'  uuid: b7ad9a05-8f7b-44af-8952-a7f717e897e0
    Total devices 1 FS bytes used 319.96GiB
    devid    1 size 390.62GiB used 390.62GiB path /dev/mapper/noether-lv

Label: 'masterchef-btrfs'  uuid: a0ed3709-1490-4f2d-96b5-bb1fb22f0b45
    Total devices 1 FS bytes used 1.62TiB
    devid    1 size 1.82TiB used 1.82TiB path /dev/mapper/masterchef--vg-btrfs

and the rpi:

$ uname -a
Linux vigilance 6.6.62+rpt-rpi-2712 #1 SMP PREEMPT Debian
1:6.6.62-1+rpt1 (2024-11-25) aarch64 GNU/Linux

$ btrfs --version
btrfs-progs v6.2

(btrfs fi show is the same for masterchef-btrfs)

In terms of possible events that could have caused this:
1. I had some issues with the raspberry pi not being able to supply
enough power for 2 external disks, and for this and related reasons
it's possible the disk got disconnected without being unmounted
properly / the pi was uncleanly shut down a few times (though, I
expect I usually didn't actually write to the disk any of these
times...)
2. When I try to mount on the raspberry pi, I see this in dmesg:

[ 5658.798634] BTRFS info (device dm-2): first mount of filesystem
a0ed3709-1490-4f2d-96b5-bb1fb22f0b45
[ 5658.798653] BTRFS info (device dm-2): using crc32c (crc32c-generic)
checksum algorithm
[ 5658.798663] BTRFS info (device dm-2): use zlib compression, level 3
[ 5658.798666] BTRFS info (device dm-2): disk space caching is enabled
[ 5658.798669] BTRFS warning (device dm-2): v1 space cache is not
supported for page size 16384 with sectorsize 4096
[ 5658.798706] BTRFS error (device dm-2): open_ctree failed

so I went and looked up what the "v1 space cache" was, and ran this:

$ btrfs check --clear-space-cache v1 <device>

and then read some more -- oh, nowadays it's a btrfs rescue command
instead, so I ctrl-C'd the above and ran:

$ btrfs rescue clear-space-cache v1 <device>

which appeared to complete successfully.

(I suppose despite seeing this message on the pi, I must have run
these commands on my laptop, since my pi's btrfs-progs doesn't have
the rescue clear-space-cache command.)

Anyway, maybe ctrl-C-ing the btrfs check --clear-space-cache was wrong?

It's noticeable that the dmesg output, at least on the raspberry pi,
still mentions the v1 space cache message when trying to mount, unless
I pass the nospace_cache mount option, in which case I get the "failed
to verify dev extents" message. (I think I get the latter message in
either case on my laptop with the newer kernel + btrfs-progs).

A natural thing to do at this stage would be to run btrfs check, but
the non-lowmem version is always OOM-killed (on either device) while
checking extents, and the lowmem version has so far not had time to
complete (and I'm not convinced it will in a reasonable duration). I
could try to borrow a machine with more RAM, though I have no idea
whether I need 20% more RAM or 20x more. (The pi is 8G, the laptop is
16G, the btrfs partition I'm checking is ~2T.)

While I'm waiting for the lowmem check to progress, are there any
other useful recovery / diagnosis steps I could try? smartctl appears
not to work with this disk, so I can't easily say whether the disk is
or is not healthy.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-01-02 17:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-14  2:17 dev extent physical offset [...] on devid 1 doesn't have corresponding chunk Ben Millwood
2024-12-14  2:51 ` Qu Wenruo
2024-12-14 17:39   ` Ben Millwood
2024-12-14 21:00     ` Qu Wenruo
2024-12-15  4:46       ` Qu Wenruo
2024-12-20 23:11         ` Ben Millwood
2024-12-20 23:51           ` Qu Wenruo
2025-01-02 17:58             ` Ben Millwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox