Re: is it possible to add a new filter to detect unusable partition types

Demi Marie Obenour <[email protected]> Tue, 17 Dec 2024 15:32:50 -0500
Newsgroups gmane.linux.lvm.general
Message-ID <Z2HgqxuHQ0elvy8T__45366.5499038593$1734467792$gmane$org@itl-email>
On Tue, Dec 17, 2024 at 11:21:26AM +0100, Zdenek Kabelac wrote:
> Dne 17. 12. 24 v 10:13 Glass Su napsal(a):
> > 
> > > On Dec 17, 2024, at 16:34, Heming Zhao <[email protected]> wrote:
> > > 
> > > Hi LVM2 maintainers,
> > > 
> > > One of SUSE's customers encountered an issue with LVM2. The user created several partitions, one of which was marked as "BIOS boot" (4) instead of "LINUX LVM" (8E). Subsequently, the user ran pvcreate/vgcreate/lvcreate on this partition. During a system update, grub2-install installed GRUB2 in the "BIOS boot" partition, resulting in LVM2 metadata corruption.
> > > 
> > > The root cause of this issue is that grub2-install targets the "BIOS boot" partition when this lvm2 device is specified for installation. If the user had initially marked the partition as "LINUX LVM", grub2-install would not have chosen this partition.
> > > 
> > > On the other hand, it would be beneficial if LVM2 could implement a new filter or a filter function to detect and exclude the "BIOS boot" partition from being considered a valid target for LVM2 device creation. This could involve issuing a warning or error message to alert the user of the potential conflict. This may also help user to notice the issue more easily.
> 
> Hi
> 
> lvm2 is using  blkid to detect 'present' signature on a block device - and
> normally prompt to confirm wiping such signature.
> 
> We may possibly add similar logic for 'partition signatures'.
> 
> However there is still the plain fact that lvm2  with  --force  or even just
> '--yes' option is assumed to simply proceed  and clean&clear such
> conflicting signatures and simply makes the block device to be a PV.
> 
> All that said IMHO primary bug here is within  'grub2-install'  which simply
> should not be blindingly overwriting  block device which is in use - this
> should be fixed ASAP as there is the biggest risk of data loss, although I
> guess everyone is using  'grub2-install --force'  - as without this option
> (even in my personal experience) is typically refusing to do any work....
> 
> And same applies to most UI tools I've seen that use lvm2 - all seem to be
> pushing  '--force & --yes' with each it emitted lvm2 command...

If prompts were in a machine-parsable format, tools that used lvm2 could
differentiate between ones that should automatically be responded to
with "yes" and ones that should not.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEopQtqVJW1aeuo9/sszaHOrMp8lMFAmdh3/oACgkQszaHOrMp
8lPXHg/+MNPwDkHJXtmyUeG0MhCMYu+2dLMiCx+wYbmPy3D6OwMgD9umCjJDfD8m
6oMAv4uyFSgXnVw3Jh/jA9O7P9C3355Hkj3hDOLAIZt0D6tdiLfNG6dZi5SbI4Rl
/f6CRUEfnMgH/UwSvlu/F2VDsxvZsWTuoqQnNfp6tCGUuYkua1V3xcIF3QTnJR6D
IJY6SWPPXKsh/bp2yQM57G7es/wm2fvNmOPaCMji2dt571Sd4r2VtIUmqhWHxmlh
m8A/seGRpH+p18DAkixDUfvzqoSV0BBcK7xkxD0cnNlhCBhBytvXyaBfYzs/zfHy
tz8+usnjrQxDkr45uDmC2rBRHrWxFzLJCd/mu1p0kIjFjkuI3SzePFAUCxm6kewx
trYvYRmj9SGTParNlpkq67tELMG2KJUNaWjKctPh+8Z+43faWwzJtFIoPOofQ5oZ
Axwc3x75Y4Dr3YxU2K+VinWwwq20CVc2j59ntULBztcj39o3Arzg8AyBm8Z5MPfl
eh0UZToBEVnXiSQrf4n2oQpbbZ8Age92GeqQ7zIOGC84zOrf59j226+aAigJYJ1r
pU2aMi5ac7QYrKn3R5RD/C1/zn3Tqm/i9U/pGQMh3sqX8avntXQ7tXpHARLU+gYN
kpzyuhFTbgbyJ70TnvRlkjsA8P3z7KUPwbP+ydscldHbML+yc4w=
=hJ+p
-----END PGP SIGNATURE-----