安装 CentOS 7 后 Windows 7 启动选项丢失,如何恢复?

安装 CentOS 7 后 Windows 7 启动选项丢失,如何恢复?

安装Centos7后,启动时不显示Windows 7。 Centos 7 可以访问。

我的启动文件夹条目:

[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 输出

[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

黑屏输出

[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 命令输出

[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

这是/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 ###

我尝试将以下条目添加到 40_custom 并运行“grub2-mkconfig -o /boot/grub2/grub.cfg”,但在输出中找不到窗口。该条目显示在启动菜单中,但单击时会出现错误“Missing BOOTMGR”。

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
}

点击windows修复后,检测到windows分区

在此输入图像描述

在此输入图像描述

在此输入图像描述

相关内容