Installed Centos 7 after Windows and can’t boot into CentOS

bootboot-loaderdual-bootgrub2

I wanted to setup a dual boot for Windows 7 and CentOS 7

I had a Windows 7 machine with 500GB disk. I shrank the Windows partition to provide space for CentOS 7 (roughly 230GB). I created a USB CentOS 7 netinstall stick and booted from that. I ran the install configured as best I knew to install CentOS 7 into the free space (rather than over the whole disk). I did the net install and all seemed to go well but when it rebooted I was back into Windows and can't get into CentOS.

I've rebooted from the USB and tried to fix the situation (carefully) using cfdisk, e.g. selecting what I believe is the CentOS boot partition but it reports "missing operating system." Also cfdisk says it can't reread the partition table when I write it with CentOS boot but starting cfdisk again seems to show the flag has been set.

Currently the USB CentOS 7 netinstall shows me the following partitions on the disk:

## DATA  
/home 168GB centos-home  

## SYSTEM  
/boot 500MB sda3  
/ 51GB centos-root  
swap 3.85GB centos-swap  

The "other" Windows partitions are:

ntfs 100MB sda1  
ntfs 253GB sda2

This looks ok BUT when I go into CentOS 7 Installation again it is telling me I have to create mount points for the root partition. I didn't do this originally as I thought it would be done automatically when I clicked "Click here to create them automatically" for the disk setup the first time I installed.

And the partition table accessed using cfdisk from "Rescue a CentOS system…" looks like this:

Unusable 1MB  
sda1 Primary ntfs 105MB    
sda2 Primary ntfs 265GB  
sda3 Boot Primary xfs 525MB    
sda5 NC Logical LVM2_member 235GB  
Logical Free space 0.03MB

As mentioned, when I try to boot with this configuration I get "missing operating system." If I change the boot flag back to sda1 then it boots into Windows 7 fine.

UPDATE #1

I (re)installed grub2 using grub2-install from netinstall on /dev/sda and now when I boot from the disk I get the grub prompt. I can using it to chain load into Windows. However, when I try to boot into CentOS 7 I get some sort of trace/dump.

I used:

linux  (hd0,msdos3)/vmlinuz-3... root=/dev/sda3
initrd (hd0,msdos3/initrd-plymouth...
boot

NOTE: I believe linux is the primary boot partition for CentOS

Trying the above just crashes.

UPDATE #2

I installed NTFS-3G and NTFSPROGS using yum from the EPEL repository.

I ran grub2-mkconfig -o /boot/grub2/grub.cfg and then rebooted to find Windows 7 (Loader) in the boot menu. But when I choose it I get:

error: no such device 978778...
error: hd1 cannot get C/H/S values....

which doesn't sound very good at all, but at least some progress.

I should also say that I now have CentOS 7 only on the internal drive and I'm working on this drive as an external USB drive (hence /dev/sdb).

Can someone please help me to get Windows to boot?

I have a Unix background but mostly use Mac OS X. I always come unstuck on setting up Windows and Linux dual boot.

Finally, I have CentOS 6.5 system running fine on another machine, as well as my Mac.

Best Answer

You probably mounted the wrong Windows partition.

Look for a small partition of 100 or 300MB (the Boot Partition of Windows), mount it and then run the command again.

If you are still having problems, add following to the end of /etc/grub.d/40_custom:

menuentry "Windows"{
    set root='(hd0,0)'
    chainloader +1
}

This is assuming the Windows boot partition is the first partition of the first hard disk.

Don't forget to run grub2-mkconfig.

Related Question