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?

- 327
- 1
- 2
- 6
1 Answers
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.

- 17,539
/etc/grub.d/40_custom
, thensudo update-grub
, but first try the automatic discover by mounting the Windows partition and runningsudo update-grub
. In any case, do not copy-paste the code from here, this is just an example (of my system). You should change the /dev/sda4 partition with yours. – NickTux Dec 26 '14 at 00:16fdisk
won't show the windows partition because the disk is formatted with GPT, so I usedparted
. Is the correct partition the one with theboot
flag, themsftres
flag, or thentfs
partition type? Thanks for your patience, by the way.EDIT: I'm sure the
– Giaphage47 Dec 26 '14 at 00:19boot
flagged partition isn't used by Ubuntu, because this disk was blank when I installed windows, if that matters.gdisk
instead. Also you must change other entries as well,insmod part_msdos
toinsmod part_gpt
. Above example code is for MBR, not GPT. You can edit your question and add the results ofparted
command and also you can try both NTFS and msftres types with separate entries in40_custom
and see what is work. – NickTux Dec 26 '14 at 00:25