Thread View: linux.debian.user
4 messages
4 total messages
Started by Tim Woodall
Sun, 01 Nov 2026 19:50
Strange PV corruption.
Author: Tim Woodall
Date: Sun, 01 Nov 2026 19:50
Date: Sun, 01 Nov 2026 19:50
25 lines
3249 bytes
3249 bytes
I've had this happen maybe a dozen times over the years and I wonder if anyone knows what I'm doing to cause it. I reboot and grub fails to find anything. ls shows memdisk and the main disk but nothing else. insmod lvm etc makes no difference at all. But once you run pvresize on the PV, grub is happy again and finds everything it needs to boot. (Note that everything is inside the VG, there's no separate boot partition.) There's neither rhyme nor reason why this is happening - which makes it doubly frustrating - if it's easy to get to the problem VG it's easy to fix, but if it's a remote machine then you lose all ability to boot anything at all and you're down to trying to remember how to boot to a rescue over ipmi. Does anyone know what I might be doing to cause this to happen, or how I can detect it ahead of a reboot? (Although I'm not sure whether you can run pvresize on an in-use PV.) Note, LVM etc is perfectly happy, it's grub that is confused. Tim.
Re: Strange PV corruption.
Author: Stefan Monnier
Date: Tue, 03 Nov 2026 03:50
Date: Tue, 03 Nov 2026 03:50
40 lines
3648 bytes
3648 bytes
> I've had this happen maybe a dozen times over the years and I wonder if
> anyone knows what I'm doing to cause it.
Seeing the hordes rushing to drown you in suggestions, I'll take
my chance. Based on what you say, I suspect I won't tell you anything
you don't already know, tho. 🙁
> I reboot and grub fails to find anything. ls shows memdisk and the main disk
> but nothing else. insmod lvm etc makes no difference at all.
>
> But once you run pvresize on the PV, grub is happy again and finds
> everything it needs to boot.
- I suspect you might get better info from Grub insiders.
Maybe it's worth opening a bug report, even if you don't have much
concrete data to provide, in the hope to get them to tell you how you
might collect useful data next time it happens.
- Maybe something corrupts some copy of the LVM info, which is the one
Grub uses, whereas `pvresize` is able to read some other copy and
silently refresh/fix the corrupted copy?
- My crystal ball is terribly hazy, but it suggests maybe some problem
in the disk makes it occasionally "fail to start up", or rather
startup in such a way that when Grub tries to get the LVM info it gets
some kind of error, even though it would succeed if it were done
a fraction of a second later.
That would be fundamentally unrelated to LVM, so I'd expect it to show
up in other ways as well, but maybe in your context there's nothing else
to affect. Running `pvresize` would simply have the effect of
slightly changing the disk's erroneous behavior.
[ E.g. maybe the problem is when the disk is shutdown in a particular
way, it takes more time to boot (e.g. because it has to work harder
to recover its "logical-to-physical block mapping", assuming it's
an SSD). ]
The last two ideas are *very* hypothetical.
=== Stefan
Re: Strange PV corruption.
Author: Tim Woodall
Date: Thu, 05 Nov 2026 11:00
Date: Thu, 05 Nov 2026 11:00
107 lines
6810 bytes
6810 bytes
On Mon, 2 Nov 2026, Stefan Monnier wrote:
>> I've had this happen maybe a dozen times over the years and I wonder if
>> anyone knows what I'm doing to cause it.
>
> Seeing the hordes rushing to drown you in suggestions, I'll take
> my chance. Based on what you say, I suspect I won't tell you anything
> you don't already know, tho. 🙁
>
>> I reboot and grub fails to find anything. ls shows memdisk and the main disk
>> but nothing else. insmod lvm etc makes no difference at all.
>>
>> But once you run pvresize on the PV, grub is happy again and finds
>> everything it needs to boot.
>
> - I suspect you might get better info from Grub insiders.
> Maybe it's worth opening a bug report, even if you don't have much
> concrete data to provide, in the hope to get them to tell you how you
> might collect useful data next time it happens.
>
Thanks!
I wasn't clear in my original email but this isn't limited to one
particular machine or one particular disk. If it weren't for the fact
that it happens apparently completely randomly, I'd assume there was a
bug from some old version of something that was leaving the lvm metadata
in an inconsistent state somewhere, nothing noticed until grub was
upgraded and gets upset until it's fixed.
But while this most recent incidence happened after an upgrade, it
happened on a reboot well after the upgrade was done. (in fact, in this
case I was doing some final cleanup on the next day and had removed old
config files that hadn't been purged, nothing else, and just did a
"final reboot to check I'd not broken something during the purge")
And I've had other instances where it's even more random. Probably
always following a kernel upgrade (because that's just about the only
time I reboot), but given that this is grub failing to even find the VG,
it surely cannot be kernel related.
I've had it happen on both SSD and magnetic.
> - Maybe something corrupts some copy of the LVM info, which is the one
> Grub uses, whereas `pvresize` is able to read some other copy and
> silently refresh/fix the corrupted copy?
>
I've done some more digging:
vg-mail {
id = "u2IS1S-14ue-2bPk-NV20-jP7f-Aogl-g1Fe8U"
- seqno = 38233
+ seqno = 38354
format = "lvm2" # informational
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
@@ -27,7 +27,7 @@ vg-mail {
status = ["ALLOCATABLE"]
flags = []
- dev_size = 128040960 # 61.0547 Gigabytes
+ dev_size = 128038912 # 61.0537 Gigabytes
pe_start = 2048
pe_count = 15629 # 61.0508 Gigabytes
}
So that pvresize did change something - but I can see that that size
hasn't changed as far back as Feb 2025 (which is the oldest backup of
the vg metadata I have online). (sadly, it turns out that lvm/archive is
excluded from etckeeper by default)
I've found this:
https://lists.gnu.org/archive/html/grub-devel/2024-05/msg00040.html
And this was booting on an old xen installation where I see:
ls -al /usr/lib/grub-xen/grub-i386-xen_pvh.bin
-rw-r--r-- 1 root root 1572400 Nov 13 2022 /usr/lib/grub-xen/grub-i386-xen_pvh.bin
I'm almost certain that this is the problem. From my current metadata:
pvck --dump headers /dev/xvda
mda_header_1.raw_locn[0].offset 373760
mda_header_1.raw_locn[0].size 3207
And from seqno 38233 to 38354 is 121 updates - which is 388047 bytes.
That would put it wrapping somewere around 116 updates ago - or roughly
5 metadata updates after I upgraded.
I can't quite make the numbers line up, I backup 5 lvs so I'd expect
roughly 10 metadata updates per day but it looks closer to 20, but I'm
starting to think that this is the problem, and I've hit it because I
backup every day and so am constantly having a churn of metadata
versions.
And the pvresize could be a red herring - the significant effect is that
it causes a metadata rewrite. It seems to bump the seqno even if nothing
changes.
So I guess my next job is to write a script to detect when the metadata
is close to wrapping and bump it past the wrap. I keep some old systems
for testing purposes, so upgrade isn't always possible.
Thanks for your reply that prompted me to dig more.
Tim.
Re: Strange PV corruption.
Author: Tim Woodall
Date: Sat, 07 Nov 2026 10:10
Date: Sat, 07 Nov 2026 10:10
12 lines
2918 bytes
2918 bytes
On Thu, 5 Nov 2026, Tim Woodall wrote: > I can't quite make the numbers line up, I backup 5 lvs so I'd expect roughly > 10 metadata updates per day but it looks closer to 20, but I'm starting to > think that this is the problem, and I've hit it because I backup every day > and so am constantly having a churn of metadata versions. > Just to close this - it turns out that a lvcreate (at least of a snapshot volume) causes two metadata updates, and likewise the lvremove. Tim.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads