2

I have been running Ubuntu 14.04 on my desktop for a year now. Today, I got Windows 7 and installed it on a separate drive with the Ubuntu drive removed. Now I can boot each OS by interrupting the BIOS and changing the boot order, so I know both bootloaders work, but when I ran sudo update-grub and sudo udpate-grub2, Windows was not listed. What can I do to add Windows to grub?

1 Answers1

0

Try to locate and mount the Windows partition first, then run sudo update-grub.

For example,

sudo fdisk -l

results

/dev/sda1            2048  53035007 53032960 25.3G 83 Linux
/dev/sda2        53035008  99139583 46104576   22G 83 Linux
/dev/sda3        99139584 141266943 42127360 20.1G 83 Linux
/dev/sda4  *    141266944 215681023 74414080 35.5G  7 HPFS/NTFS/exFAT

in this case the Windows partition is /dev/sda4 (because of NTFS Type and because I know it). Then,

sudo mount /dev/sda4 /mnt

and then

sudo update-grub

Windows entry in grub.cfg is nothing special. It is just a chainloader entry. If above method fails to identify Windows properly, then you can manually add the entry in /etc/grub.d/40_custom file.

Example of Windows 40_custom entry for MBR (not GPT)

menuentry "Windows 7 64bit" --class windows --class os {
        insmod part_msdos
        insmod ntfs
        set root='hd0,msdos4'
        chainloader +1
}

What matters here is the set root parameter. hd0,msdos4 = /dev/sda4. If you have more than one HDDs then it might be hd1,msdos4 = /dev/sdb4.

If you follow the manual method, don't forget to run sudo update-grub after editing the 40_custom file.

NickTux
  • 17,865
  • 6
  • 57
  • 66