Richard W.M. Jones
2022-May-16 15:46 UTC
[Libguestfs] [PATCH v2v] convert: Ignore /dev/mapper/osprober-* devices when trimming
These devices can be left around by either grub2 or the osprober tool. They are read-only mirrors of existing filesystems and it appears we can safely ignore them. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2003503 --- convert/convert.ml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/convert/convert.ml b/convert/convert.ml index 87fca7252b..997f6b08bd 100644 --- a/convert/convert.ml +++ b/convert/convert.ml @@ -194,10 +194,16 @@ and do_fstrim g inspect (* Get all filesystems. *) let fses = g#list_filesystems () in + (* Ignore unknown/swap devices. *) let fses = List.filter_map ( function (_, ("unknown"|"swap")) -> None | (dev, _) -> Some dev ) fses in + (* Ignore filesystems left around by osprober (RHBZ#2003503). *) + let fses + List.filter (fun dev -> not (String.is_prefix dev "/dev/mapper/osprober-")) + fses in + (* Trim the filesystems. *) List.iter ( fun dev -> -- 2.35.1
Laszlo Ersek
2022-May-17 05:54 UTC
[Libguestfs] [PATCH v2v] convert: Ignore /dev/mapper/osprober-* devices when trimming
On 05/16/22 17:46, Richard W.M. Jones wrote:> These devices can be left around by either grub2 or the osprober tool. > They are read-only mirrors of existing filesystems and it appears we > can safely ignore them. > > Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2003503 > --- > convert/convert.ml | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/convert/convert.ml b/convert/convert.ml > index 87fca7252b..997f6b08bd 100644 > --- a/convert/convert.ml > +++ b/convert/convert.ml > @@ -194,10 +194,16 @@ and do_fstrim g inspect > (* Get all filesystems. *) > let fses = g#list_filesystems () in > > + (* Ignore unknown/swap devices. *) > let fses = List.filter_map ( > function (_, ("unknown"|"swap")) -> None | (dev, _) -> Some dev > ) fses in > > + (* Ignore filesystems left around by osprober (RHBZ#2003503). *) > + let fses > + List.filter (fun dev -> not (String.is_prefix dev "/dev/mapper/osprober-")) > + fses in > + > (* Trim the filesystems. *) > List.iter ( > fun dev -> >I've read up on os-prober: https://www.thegeekdiary.com/how-to-disable-os-prober-in-centos-rhel-7/ https://github.com/campadrenalin/os-prober http://joeyh.name/code/os-prober/ and it's *absolutely infuriating* that os-prober itself, or whatever invokes os-prober, litters the system with block device nodes. In fact, I don't even know how it is *possible* for a device node to be left around under /dev/mapper -- I thought /dev/mapper/ would be re-populated *from zero* every time the system boots? Do we have something in the appliance perhaps that *creates* these files? I'm quite unhappy about ignoring these filesystems in "do_fstrim" *only*. If guestfs_list_filesystems() returns them in the first place, won't that cause confusion for other libguestfs applications or scripts? Do we expect the same filesystem to appear multiply in the list-filesystems output? I think this is a serious bug in some component different from libguestfs / virt-v2v. Hmmm... After reading your comment <https://bugzilla.redhat.com/show_bug.cgi?id=2003503#c12>, I think we absolutely need to report a bug for grub2. I'll contact the rhboot team. I don't disagree that we have to work it around, but until we understand the problem better, I don't feel safe about filtering these nodes out only in virt-v2v's trimming function. Thanks Laszlo