1

So, I installed Ubuntu 10.10 in my computer. I already had Windows 7 installed beforehand. I have 2 drives. An 80GB SSD and a 500GB HDD. Ubuntu is installed in part of the HDD. Windows 7 is installed in the SSD. However, the Windows 7 boot option doesn't show up in Grub. I tried to update it and it did update but nothing happened. So I am wondering if I can add it manually somehow. Here is the df -h i ran.

Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1             138G  3.8G  127G   3% /
none                  7.9G  296K  7.9G   1% /dev
none                  7.9G  856K  7.9G   1% /dev/shm
none                  7.9G   92K  7.9G   1% /var/run
none                  7.9G     0  7.9G   0% /var/lock
/dev/sda1              75G   57G   18G  76% /media/BlinkSSD
Jorge Castro
  • 71,754
Antonis
  • 11

1 Answers1

2

The first step is to edit /etc/grub.d/40_custom (using sudo) and add the following lines to the bottom of the file:

menuentry ‘Windows 7′ {  
    set root=’(hd0,msdos2)’  
    chainloader +1  
}  

Since the location of the Windows installation can differ widely, I need to explain the “set root” line because (hd0,msdos2) refers to /dev/sda2 on my machine.

More generally, hd0 (or /dev/sda elsewhere) refers to the first hard disk installed in any PC with hd1 (or /dev/sdb elsewhere) being the second and so on. While I was expecting to see entries like (hd0,6) in /boot/grub/grub.cfg, what I saw were ones like (hd0,msdos6) instead with the number in the text after the comma being the partition identifier; 1 is the first (sda1), 2 (sda2) is the second and so on. The next line (chainloader) tells GRUB to load the first sector of the Windows drive so that it can boot. After all that decoding, my final comment on what’s above is a simple one: the text “Windows 7″ is what will appear in the GRUB menu so you can change this as you see fit.

After saving 40_custom, the next step is to issue the following command to update grub.cfg:

sudo update-grub2

Once that has done its business, then you can look into /boot/grub/grub.cfg to check that the text added into 40_custom has found its way into there. That is important because this is the file read by GRUB2 when it builds the menu that appears at start-up time. A system reboot will prove conclusively that the new entry has been added successfully.

Credits go to: http://technologytales.com/2010/11/21/manually-adding-an-entry-for-windows-7-to-an-ubuntu-grub2-menu/

Or check: Add Windows 7 to boot menu

LnxSlck
  • 12,256