I have two disks with two different OSes installed on each – one for Windows XP and one for Fedora 19. They work happily with each other and don’t cause any issues.

Two weeks ago, I decided to upgrade Windows XP to Windows 7. Installation worked fine, Windows 7 boots without problems (although I need to unplug the Fedora disk because Windows 7 just couldn’t allow me to proceed with the installation with two disks connected).

However, when I re-plugged the other disk back and boot from Fedora as usual, Windows won’t start if I select it from the GRUB menu (I already suspected this problem before I tried to upgrade Windows).

The simplest solution is to re-install Fedora again and the installer should be able to pick up the new Windows 7 without problems, but I will have to re-install everything under Fedora, which is not desired.

To fix this issue, I followed the following steps:

1. Find out the UUID in the Windows partition. In most cases (and in my case too), it is /dev/sda1, to be sure, you can run “gdisk” as root:

[root@localhost]# gdisk -l /dev/sda

GPT fdisk (gdisk) version 0.8.8

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present

Disk /dev/sda: 1953523055 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 39402158-CA16-42CC-AC6F-2320B82B2498
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953523021
Partitions will be aligned on 8-sector boundaries
Total free space is 6979 sectors (3.4 MiB)

Number Start (sector) End (sector) Size Code Name
1 2048 104855551 50.0 GiB 0700 Microsoft basic data
5 104857264 167771286 30.0 GiB 0700 Microsoft basic data
6 167771583 1006633151 400.0 GiB 0700 Microsoft basic data
7 1006633215 1953520127 451.5 GiB 0700 Microsoft basic data

My Windows is installed on the 50GB partition, which is the first one.

2. Seondly, I needed to find the UUID for this partition, run

[root@localhost]# blkid /dev/sda1

/dev/sda1: UUID="0C6E54886E546C88" TYPE="ntfs"<

3. Finally I need to update the grub.cfg file with the new UUID. Open file /boot/grub2/grub.cfg, and scroll to the part that have Windows information


### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Microsoft Windows (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-16D8D903D8D8E253' {
insmod part_msdos
insmod ntfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 16D8D903D8D8E253
else
search --no-floppy --fs-uuid --set=root 16D8D903D8D8E253
fi
drivemap -s (hd0) ${root}
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

Simply replace “16D8D903D8D8E253” with “0C6E54886E546C88”,


### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Microsoft Windows (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-0C6E54886E546C88' {
insmod part_msdos
insmod ntfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 0C6E54886E546C88
else
search --no-floppy --fs-uuid --set=root 0C6E54886E546C88
fi
drivemap -s (hd0) ${root}
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

then reboot your computer.

Now you should be able to select the Windows entry from the GRUB menu in the boot up.

Leave a Reply

Your email address will not be published. Required fields are marked *