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

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

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.

After a little reading I think this can be fixed in a generic way, since Microsoft has some guidelines for marking recovery partitions.

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"

Reply to: