Centos7 与 Windows 8 双启动问题

Centos7 与 Windows 8 双启动问题

我安装的是CentOS7而不是Ubuntu。
我还安装了 Windows 8。
安装 CentOS7 后,我无法运行 Windows。
我的笔记本电脑:华硕 R510J

启动脚本:

                  Boot Info Script 0.61      [1 April 2012]


============================= Boot Info Summary: ===============================

 => No boot loader is installed in the MBR of /dev/sda.

sda1: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  FAT16
    Boot sector info:  According to the info in the boot sector, sda1 starts 
                       at sector 0. But according to the info from fdisk, 
                       sda1 starts at sector 2048.
    Operating System:  
    Boot files:        

sda2: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /bootmgr /Boot/BCD

sda3: __________________________________________________________________________

    File system:       
    Boot sector type:  -
    Boot sector info: 
    Mounting failed:   mount: unknown filesystem type ''

sda4: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /bootmgr /Boot/BCD /Windows/System32/winload.exe

sda5: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        

sda6: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        

sda7: __________________________________________________________________________

    File system:       xfs
    Boot sector type:  -
    Boot sector info: 
    Operating System:  
    Boot files:        /grub2/grub.cfg

sda8: __________________________________________________________________________

    File system:       LVM2_member
    Boot sector type:  -
    Boot sector info: 

centos-root': __________________________________________________________________

    File system:       
    Boot sector type:  Unknown
    Boot sector info: 
    Mounting failed:   mount: unknown filesystem type ''
mount: unknown filesystem type ''

centos-swap': __________________________________________________________________

    File system:       
    Boot sector type:  Unknown
    Boot sector info: 
    Mounting failed:   mount: unknown filesystem type ''
mount: unknown filesystem type ''
mount: unknown filesystem type ''

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disk /dev/sda: 480.1 GB, 480103981056 bytes, 937703088 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

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1                   1   937,703,087   937,703,087  ee GPT


GUID Partition Table detected.

Partition    Start Sector    End Sector  # of Sectors System
/dev/sda1           2,048       206,847       204,800 EFI System partition
/dev/sda2         206,848     2,050,047     1,843,200 Windows Recovery Environment (Windows)
/dev/sda3       2,050,048     2,312,191       262,144 Microsoft Reserved Partition (Windows)
/dev/sda4       2,312,192   195,117,055   192,804,864 Data partition (Windows/Linux)
/dev/sda5     377,391,104   906,223,615   528,832,512 Data partition (Windows/Linux)
/dev/sda6     906,223,616   937,701,375    31,477,760 Windows Recovery Environment (Windows)
/dev/sda7     195,117,056   196,141,055     1,024,000 Data partition (Windows/Linux)
/dev/sda8     196,141,056   376,244,223   180,103,168 Logical Volume Manager (LVM) partition (Linux)

"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/mapper/centos-root 8fd14e11-094d-4eb3-962a-f59e92fbb93a   xfs        
/dev/mapper/centos-swap 08c14e2d-e869-4185-8604-802330769b3f   swap       
/dev/sda1        44E0-3EBB                              vfat       
/dev/sda2        A26E27356E2701A1                       ntfs       Recovery
/dev/sda3                                                          
/dev/sda4        8C7A1FC27A1FA7CA                       ntfs       OS
/dev/sda5        445E1D585E1D43D8                       ntfs       Data
/dev/sda6        8E082DDA082DC257                       ntfs       Restore
/dev/sda7        7eb2363a-e4fe-49eb-b437-49935fde30be   xfs        
/dev/sda8        EIKhsp-vfTS-ONfc-3vQ9-Wpfr-Ob2w-pYCTaM LVM2_member 

========================= "ls -R /dev/mapper/" output: =========================

/dev/mapper:
centos-root
centos-swap
control

================================ Mount points: =================================

Device           Mount_Point              Type       Options

/dev/mapper/centos-root /                        xfs        (rw,relatime,attr2,inode64,noquota)
/dev/sda1        /boot/efi                vfat       (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)
/dev/sda7        /boot                    xfs        (rw,relatime,attr2,inode64,noquota)


============================= sda7/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/00_tuned ###
set tuned_params=""
### END /etc/grub.d/00_tuned ###

### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n "${GRUB2_PASSWORD}" ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux (4.5.0-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.5.0-1.el7.elrepo.x86_64-advanced-8fd14e11-094d-4eb3-962a-f59e92fbb93a' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt
    insmod xfs
    set root='hd0,gpt7'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7  7eb2363a-e4fe-49eb-b437-49935fde30be
    else
      search --no-floppy --fs-uuid --set=root 7eb2363a-e4fe-49eb-b437-49935fde30be
    fi
    linuxefi /vmlinuz-4.5.0-1.el7.elrepo.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet rdblacklist=nouveau 
    initrdefi /initramfs-4.5.0-1.el7.elrepo.x86_64.img
}
menuentry 'CentOS Linux (3.10.0-327.13.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.13.1.el7.x86_64-advanced-8fd14e11-094d-4eb3-962a-f59e92fbb93a' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt
    insmod xfs
    set root='hd0,gpt7'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7  7eb2363a-e4fe-49eb-b437-49935fde30be
    else
      search --no-floppy --fs-uuid --set=root 7eb2363a-e4fe-49eb-b437-49935fde30be
    fi
    linuxefi /vmlinuz-3.10.0-327.13.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet rdblacklist=nouveau 
    initrdefi /initramfs-3.10.0-327.13.1.el7.x86_64.img
}
menuentry 'CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-8fd14e11-094d-4eb3-962a-f59e92fbb93a' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt
    insmod xfs
    set root='hd0,gpt7'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7  7eb2363a-e4fe-49eb-b437-49935fde30be
    else
      search --no-floppy --fs-uuid --set=root 7eb2363a-e4fe-49eb-b437-49935fde30be
    fi
    linuxefi /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet rdblacklist=nouveau 
    initrdefi /initramfs-3.10.0-327.el7.x86_64.img
}
menuentry 'CentOS Linux (0-rescue-2cc685281d934fa0a98912fc50f1893d) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-2cc685281d934fa0a98912fc50f1893d-advanced-8fd14e11-094d-4eb3-962a-f59e92fbb93a' {
    load_video
    insmod gzio
    insmod part_gpt
    insmod xfs
    set root='hd0,gpt7'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7  7eb2363a-e4fe-49eb-b437-49935fde30be
    else
      search --no-floppy --fs-uuid --set=root 7eb2363a-e4fe-49eb-b437-49935fde30be
    fi
    linuxefi /vmlinuz-0-rescue-2cc685281d934fa0a98912fc50f1893d root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet rdblacklist=nouveau 
    initrdefi /initramfs-0-rescue-2cc685281d934fa0a98912fc50f1893d.img
}

### 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.

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

menuentry "Windows 8" {
    insmod part_gpt
    insmod chain
    set root='(hd0,gpt3)'
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}


#menuentry 'Windows 8 (loader)' {
#        insmod part_msdos
#        insmod ntfs
#        set root='hd0,msdos1'
#        ntldr /bootmgr
#}
### 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 ###
--------------------------------------------------------------------------------

=================== sda7: Location of files loaded by Grub: ====================

           GiB - GB             File                                 Fragment(s)


======================== Unknown MBRs/Boot Sectors/etc: ========================

Unknown BootLoader on centos-root'


Unknown BootLoader on centos-swap'



=============================== StdErr Messages: ===============================

cat: /tmp/BootInfo-S4HqYaMe/Tmp_Log: No such file or directory
  Failed to find logical volume "centos/root'"
  Failed to find logical volume "centos/root'"
  Failed to find logical volume "centos/root'"
hexdump: /dev/mapper/centos-root': No such file or directory
hexdump: stdin: Bad file descriptor
hexdump: /dev/mapper/centos-root': No such file or directory
hexdump: all input file arguments failed
  Failed to find logical volume "centos/swap'"
  Failed to find logical volume "centos/swap'"
  Failed to find logical volume "centos/swap'"
hexdump: /dev/mapper/centos-swap': No such file or directory
hexdump: stdin: Bad file descriptor
hexdump: /dev/mapper/centos-swap': No such file or directory
hexdump: all input file arguments failed
mdadm: No arrays found in config file or automatically

fdisk -l :

➜  ~ sudo fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 480.1 GB, 480103981056 bytes, 937703088 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      2050047    900M  Windows recover Basic data partition
 3      2050048      2312191    128M  Microsoft reser Microsoft reserved partition
 4      2312192    195117055     92G  Microsoft basic Basic data partition
 5    377391104    906223615  252.2G  Microsoft basic Basic data partition
 6    906223616    937701375     15G  Windows recover Basic data partition
 7    195117056    196141055    500M  Microsoft basic 
 8    196141056    376244223   85.9G  Linux LVM       

Disk /dev/mapper/centos-root: 85.9 GB, 85899345920 bytes, 167772160 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-swap: 6308 MB, 6308233216 bytes, 12320768 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/sdb: 4009 MB, 4009754624 bytes, 7831552 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: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *         128     7831551     3915712    b  W95 FAT32

sudo grub2-mkconfig -o /boot/grub2/grub.cfg :

➜  ~ sudo grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.5.0-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.5.0-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.13.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.13.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-2cc685281d934fa0a98912fc50f1893d
Found initrd image: /boot/initramfs-0-rescue-2cc685281d934fa0a98912fc50f1893d.img
done

和 /etc/grub.d/40_custom 文件:

#!/bin/sh
exec tail -n +3 $0
# 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.

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

#menuentry "Windows 8" {
#    insmod part_gpt
#    insmod chain
#    set root='(hd0,gpt1)'
#    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
#}


#menuentry 'Windows 8 (loader)' {
#        insmod part_msdos
#        insmod ntfs
#        set root='hd0,msdos1'
#   chainloader +1
#        ntldr /bootmgr
#}

menuentry "Windows 8" {
insmod part_gpt
insmod ntfs
insmod search_fs_uuid
insmod chain
chainloader /EFI/BOOT/BOOTX64.EFI
}

我尝试了很多分区名称或链加载器的混合。我读到有人在安装 CentOS7 后遇到 EFI 启动名称错误的问题。我也尝试将正确的 EFI 文件复制到可启动的 Windows 分区中

➜ ~ sudo grub2-mkconfig -o /boot/grub2/grub.cfg 的返回始终相同。

无论如何,在 BIOS 中我添加了可从 uefi 启动选项,Windows 8 显示在 grub 中,但选择后: 在此输入图像描述 当我点击“e”时: 在此输入图像描述 我也尝试更改根分区和链加载器。

我已经安装了 ntfs-3d、epel 和其他一切来运行它。我可以从 Centos 看到 Windows 文件。

我很高兴获得任何帮助。如果可能的话我不想重新安装Windows或CentOS......

答案1

找到 bootmgfw.efi 所在的正确分区,并相应地设置根分区。要找到 bootmgfw.efi 所在的分区,请进入 grub 救援模式(按'e'进而F2),然后输入LS。这将显示分区(windows 和 centos)。通过反复试验,尝试通过给出 sayls (hd0,gpt1)等来定位 bootmgfw.efi。找到包含 bootmgfw.efi 的分区后,在行中指定该分区set root=。然后,这应该找到 Windows efi 启动管理器并允许您启动到 Windows。

相关内容