Windows 7 boot option missing after installing CentOS 7, how can I get it back?
After installing Centos7, windows 7 is not showing at the boot time. Centos 7 is accessible.
My boot folder entries:
[root@localhost boot]# ls -ltr
total 89176
-rw-------. 1 root root 2840084 Jun 30 07:17 System.map-3.10.0-123.el7.x86_64
-rw-r--r--. 1 root root 122059 Jun 30 07:17 config-3.10.0-123.el7.x86_64
-rwxr-xr-x. 1 root root 4902656 Jun 30 07:17 vmlinuz-3.10.0-123.el7.x86_64
-rw-r--r--. 1 root root 228562 Jun 30 07:20 symvers-3.10.0-123.el7.x86_64.gz
drwxr-xr-x. 2 root root 4096 Nov 21 05:27 extlinux
drwxr-xr-x. 2 root root 26 Nov 21 05:28 grub
-rw-r--r--. 1 root root 867424 Nov 21 05:38 initrd-plymouth.img
-rw-r--r--. 1 root root 42219459 Nov 21 05:39 initramfs-0-rescue-4d161cb1c811459b927aed6f75f7deed.img
-rwxr-xr-x. 1 root root 4902656 Nov 21 05:39 vmlinuz-0-rescue-4d161cb1c811459b927aed6f75f7deed
-rw-r--r--. 1 root root 17637360 Nov 21 05:40 initramfs-3.10.0-123.el7.x86_64.img
-rw-r--r--. 1 root root 17584068 Nov 21 11:59 initramfs-3.10.0-123.el7.x86_64kdump.img
drwxr-xr-x. 6 root root 104 Nov 25 02:52 grub2
fdisk -l output
[root@localhost boot]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 250.1 GB, 250059350016 bytes, 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
# Start End Size Type Name
1 2048 206847 100M EFI System EFI system partition
2 206848 468991 128M Microsoft reser Microsoft reserved partition
3 468992 348162047 165.8G Microsoft basic Basic data partition
4 348162048 348164095 1M BIOS boot parti
5 348164096 349188095 500M Microsoft basic
6 349188096 488396799 66.4G Linux LVM
Disk /dev/mapper/centos-swap: 8262 MB, 8262778880 bytes, 16138240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-root: 42.3 GB, 42341498880 bytes, 82698240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-home: 20.7 GB, 20669530112 bytes, 40370176 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
bklid output
[root@localhost boot]# bklid
bash: bklid: command not found...
Similar command is: 'blkid'
[root@localhost boot]# blkid
/dev/sr0: UUID="2011-04-12-02-38-58-00" LABEL="GSP1RMCPRXFRER_EN_DVD" TYPE="udf"
/dev/sda1: UUID="20DD-5268" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="ef67b4eb-4514-4824-a1ba-d8d045e96f26"
/dev/sda3: UUID="EAD6EA4AD6EA169B" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="fa8c0ee9-2913-45ec-b016-0c6eb2e4aab8"
/dev/sda5: UUID="368a42d5-e9f9-4c81-81e2-70afe2344b6b" TYPE="xfs" PARTUUID="7447a676-d39b-46fc-948b-f1c4a3b4bf9c"
/dev/sda6: UUID="VfFTVf-Rdy5-kLFT-Zyys-PIEf-PnOo-gSZfLZ" TYPE="LVM2_member" PARTUUID="b2677b42-22fb-42f8-a287-77ad0638b674"
/dev/mapper/centos-swap: UUID="155e4385-547c-4c0b-94bd-13882f078548" TYPE="swap"
/dev/dm-2: UUID="a4709eae-75fd-4423-8f11-64762df974df" TYPE="xfs"
/dev/dm-1: UUID="24a077fa-6b00-4da0-9d07-34048d84d853" TYPE="xfs"
grub2-mkconfig -o /boot/grub2/grub.cfg command output
[root@localhost boot]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Warning: Please don't use old title `CentOS Linux, with Linux 3.10.0-123.el7.x86_64' for GRUB_DEFAULT, use `Advanced options for CentOS Linux>CentOS Linux, with Linux 3.10.0-123.el7.x86_64' (for versions before 2.00) or `gnulinux-advanced-24a077fa-6b00-4da0-9d07-34048d84d853>gnulinux-3.10.0-123.el7.x86_64-advanced-24a077fa-6b00-4da0-9d07-34048d84d853' (for 2.00 or later)
Found linux image: /boot/vmlinuz-0-rescue-4d161cb1c811459b927aed6f75f7deed
Found initrd image: /boot/initramfs-0-rescue-4d161cb1c811459b927aed6f75f7deed.img
done
Here is the content of /boot/grub2/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set pager=1
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="${saved_entry}"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
terminal_output console
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux, with Linux 3.10.0-123.el7.x86_64' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.el7.x86_64-advanced-24a077fa-6b00-4da0-9d07-34048d84d853' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod xfs
set root='hd0,gpt5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5 --hint='hd0,gpt5' 368a42d5-e9f9-4c81-81e2-70afe2344b6b
else
search --no-floppy --fs-uuid --set=root 368a42d5-e9f9-4c81-81e2-70afe2344b6b
fi
linux16 /vmlinuz-3.10.0-123.el7.x86_64 root=UUID=24a077fa-6b00-4da0-9d07-34048d84d853 ro rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet
initrd16 /initramfs-3.10.0-123.el7.x86_64.img
}
menuentry 'CentOS Linux, with Linux 0-rescue-4d161cb1c811459b927aed6f75f7deed' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-4d161cb1c811459b927aed6f75f7deed-advanced-24a077fa-6b00-4da0-9d07-34048d84d853' {
load_video
insmod gzio
insmod part_gpt
insmod xfs
set root='hd0,gpt5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5 --hint='hd0,gpt5' 368a42d5-e9f9-4c81-81e2-70afe2344b6b
else
search --no-floppy --fs-uuid --set=root 368a42d5-e9f9-4c81-81e2-70afe2344b6b
fi
linux16 /vmlinuz-0-rescue-4d161cb1c811459b927aed6f75f7deed root=UUID=24a077fa-6b00-4da0-9d07-34048d84d853 ro rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet
initrd16 /initramfs-0-rescue-4d161cb1c811459b927aed6f75f7deed.img
}
if [ "x$default" = 'CentOS Linux, with Linux 3.10.0-123.el7.x86_64' ]; then default='Advanced options for CentOS Linux>CentOS Linux, with Linux 3.10.0-123.el7.x86_64'; fi;
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
I have tried adding below entry to 40_custom and ran "grub2-mkconfig -o /boot/grub2/grub.cfg", could not find windows in the output. The entry shows in the boot menu but gives an error "Missing BOOTMGR" when clicked.
menuentry 'Windows 7 (loader) (on /dev/sda3)' --class windows --class os $menuentry_id_option 'osprober-chain-EAD6EA4AD6EA169B' {
insmod part_gpt
insmod ntfs
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root –hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci1, gpt3 EAD6EA4AD6EA169B
else
search --no-floppy --fs-uuid --set=root EAD6EA4AD6EA169B
fi
chainloader +1
}
restore windows 7 bootloader after installing Centos
Ok, That, I had Windows 7 on hard disk, and have free logical disk,
so I decided install Centos 6.4 to here. But after installing I see boot
shows Centos 6.4
and Other
. If I choose Other
, I can't load windows. I remember that, when installing Centos I choose default boot as windows boot.
So, now, What I should do for repair windows bootloader ?
Edit:
[root@dhcppc0 grub]# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0x000953c6
Device Boot Start End Blocks Id System
/dev/sda1 1 15678 125931520 5 Extended
/dev/sda2 * 15678 15691 102400 42 SFS
/dev/sda3 15691 36189 164645888 42 SFS
/dev/sda4 36189 121602 686080728 42 SFS
/dev/sda5 1 65 512000 83 Linux
/dev/sda6 65 7897 62914560 83 Linux
/dev/sda7 7897 15156 58306560 83 Linux
/dev/sda8 15156 15678 4193280 82 Linux swap / Solaris
Insert the windows installation disc and click through until you reach the screen with the "install now" button. But instead of clicking that button, click on "repair your computer" further down. Then choose "use recovery tools..", then click on the command prompt button.
In CMD type:
# bootrec /fixmbr
This should repair the master boot record.
-
1I'd try this, but windows still doesn't boot.
-
And if it worked then CentOS wouldn't boot. Windows doesn't play nicely with other OSs - you have to install Windows first, then install the other OS, then fix Grub so that it recognizes both.
Windows 7 Boot Loader Problems
- Insert the Windows 7 installation DVD OR Bootable USB
- Select Repair your computer option windows takes some time to load what ever Error got just click OK Or NEXT
- Once you have reached the System Recovery Options screen click Command Prompt to continue
Enter following command
Bootrec /Fixmbr
if not works then try
Bootsect /nt60 c: