Windows Vista disappeared from my grub boot options after update to grub2 (How to revert back Windows Vista to Grub boot menu)

Friday, 22nd October 2010

(How to revert back Windows Vista to Grub boot menu)A couple of weeks before I’ve noticed that my Windows Vista diasappeared from my boot options in Grub
Actually the Windows Vista disappared from the grub OS boot screen, right after the grub package was updated to grub2.

It appears in the Debian Testing/Unstable (Squeeze / Sid) and apparently the newer releases of Debian after the stable one, the grub package is being substituted with the transitional package Grub2 .

In grub2 there are plenty of improvements over the good old grub, anyways. As with most advancements the grub2 I find a bit more complicated and the way for editing the boot options operating system I find more harder to achieve than with the grub generation 1.

Anyways the comparison between grub and grub2 is a very long discussion which can be followed on many forums online, the main goal of this article is to show you the few simple steps I took to include my Windows Vista as a boot option once again in my grub 2 Operationg Systems selection menu.

1. Use fdist to determine the exact partition where your Windows Vista is located

hipo@debian:/etc/grub.d$ /sbin/fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2d92834c

Device Boot Start End Blocks Id System
/dev/sda1 1 721 5786624 27 Unknown
Partition 1 does not end on cylinder boundary.
/dev/sda2 * 721 9839 73237024 7 HPFS/NTFS
/dev/sda3 9839 19457 77263200 5 Extended
/dev/sda5 9839 12474 21167968+ 83 Linux
/dev/sda6 12474 16407 31593208+ 83 Linux
/dev/sda7 16407 16650 1950448+ 82 Linux swap / Solaris
/dev/sda8 16650 19457 22551448+ 83 Linux
hipo@noah:/etc/grub.d$

2. Create an empty file in /etc/grub.d/42_Windows
If 42_ number is already existing or a script with a higher number is already present in /etc/grub.d you will need to assign a number that doesn’t coincide with another script’s head number.

3. Open the empty file and edit it with your favourite text editorI personally use vim 🙂
debian:~# vim /etc/grub.d/42_Windows

As in my case /dev/sda2 is the partition where my Windows Vista is installed I had to set root='(hd0,2)’ in the script placed in 42_Windows that you can see below:

#!/bin/sh -e
echo "Adding Windows" >&2
cat << EOF
menuentry "Windows Vista" {
set root='(hd0,2)'
chainloader +1
}
EOF

Note! here that in the above code (hd2,0) should be set according to your partition as it shows in fdisk.
4. Last you need to execute the update-grub cmd

debian:~# update-grub

All left is to Restart your Linux and your Windows Vista should show in the boot menu OS options.

Share this on:

Download PDFDownload PDF

Tags:

Leave a Reply

CommentLuv badge