[Libguestfs] [PATCH] daemon: In list_filesystems ignore /dev/mapper/osprober-* devices

Laszlo Ersek lersek at redhat.com
Tue May 17 10:59:04 UTC 2022


On 05/17/22 12:20, Richard W.M. Jones wrote:
> After virt-v2v runs grub2, which runs osprober, the osprober tool
> leaves around read-only linear DM maps covering existing filesystems.
> These should be ignored since they duplicate the existing filesystems.
> 
> https://listman.redhat.com/archives/libguestfs/2022-May/028871.html
> https://bugzilla.redhat.com/show_bug.cgi?id=2003503#c12
> 
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2003503
> ---
>  daemon/listfs.ml | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/daemon/listfs.ml b/daemon/listfs.ml
> index 63ced260a1..fef8b72bb7 100644
> --- a/daemon/listfs.ml
> +++ b/daemon/listfs.ml
> @@ -41,6 +41,7 @@ let rec list_filesystems () =
>     *)
>    let devices = Lvm_dm.list_dm_devices () in
>    let devices = List.filter is_not_partitioned_device devices in
> +  let devices = List.filter is_not_osprober_device devices in
>    List.iter (check_with_vfs_type ret) devices;
>  
>    (* Partitions. *)
> @@ -90,6 +91,15 @@ and is_not_partitioned_device device =
>  
>    not has_partition
>  
> +(* In some circumstances the osprober tool (run by grub2) leaves
> + * around orphaned device-mapper maps which cover existing filesystems.
> + * These should be ignored.  See:
> + * https://listman.redhat.com/archives/libguestfs/2022-May/028871.html
> + * https://bugzilla.redhat.com/show_bug.cgi?id=2003503#c12
> + *)
> +and is_not_osprober_device device =
> +  not (String.is_prefix device "/dev/mapper/osprober-")
> +
>  (* We should ignore Windows Logical Disk Manager (LDM) partitions,
>   * because these are members of a Windows dynamic disk group.  Trying
>   * to read them will cause errors (RHBZ#887520).  Assuming that
> 

Good to see that this approach actually matches prior art -- meaning
"is_not_partitioned_device"! If
<https://bugzilla.redhat.com/show_bug.cgi?id=2003503#c17> does not work
out, I'll be OK with this patch, so tentatively:

Acked-by: Laszlo Ersek <lersek at redhat.com>

Thanks!
Laszlo


More information about the Libguestfs mailing list