[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#547382: Detect windows recovery partitions (fix provided)


On Sat, Sep 19, 2009 at 6:27 AM,  <r.c.volgers@student.utwente.nl> wrote:
> Package: os-prober
> Version: 1.33
> The version of os-prober in ubuntu 9.10 alpha 6 fails to detect the recovery partition on my acer laptop, instead detecting it as a second vista install. This leads to two identical options in grub, which is confusing.

I agree it is confusing and we ought to do something about it.

> After adding the following lines to /usr/lib/os-probes/mounted/20microsoft (near the bottom) my recovery partition is properly labeled in Grub.
> This code should be safe, since the FS was already confirmed to be a MS one.
> Apologies for the sed ugliness, but sfdisk wants the partition id as a separate parameter ('/dev/sda 1' instead of '/dev/sda1'), so I couldn't see any other way.
> # Detect recovery partitions by comparing partition id to 27 (hex value, so string comparison)
> # For more details on recovery partitions:
> # http://blogs.msdn.com/winre/archive/2007/01/12/how-to-install-winre-on-the-hard-disk.aspx
> if partid=$(sfdisk --print-id $(echo $partition | sed 's/^\(.*\)\([0-9]\)$/\1 \2/')) && [ $partid = "27" ] ; then
>        long="Recovery partition for $long"
> fi

I don't think this matching is generic enough for other possible
devices name. I ended up with following patch (untested):

Index: os-probes/mounted/x86/20microsoft
--- os-probes/mounted/x86/20microsoft   (revisão 60796)
+++ os-probes/mounted/x86/20microsoft   (cópia de trabalho)
@@ -53,6 +53,11 @@
                        long="Windows NT/2000/XP (loader)"
+# Detect recovery partitions by comparing partition id to 27.
+# Details about MS guidelines  on recovery partitions:
+# http://blogs.msdn.com/winre/archive/2007/01/12/how-to-install-winre-on-the-hard-disk.aspx
+elif partid=$(sfdisk --print-id $(echo $partition | sed
's/^\([a-z/]*\)\([0-9]*\)$/\1 \2/')) && [ $partid = "27" ] ; then
+        long="Recovery partition for $long"
 elif [ -d "$(item_in_dir dos $2)" ]; then
        long="MS-DOS 5.x/6.x/Win3.1"

Could you test it?

Otavio Salvador                  O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854         http://projetos.ossystems.com.br

Reply to: