EFI GPT Windows 7 引导加载程序/管理器问题和 grub

Nkc*_*y84 2 windows-7 hard-drive efi multi-boot gpt

我的计算机(asus N76VM 64 位)预装了 Windows 7(64 位家庭专业版),在从后来安装的 Ubuntu 环境分区时处于错误状态。这导致我运行testdisk并将每个单独的分区复制到备份硬盘上。
我设法以一种类似于事情变坏之前的状态将其全部恢复到原始硬盘驱动器上。

****我能够在所有麻烦开始之前启动到两个操作系统!****

由于“修复”硬盘驱动器,计算机仍然不想启动 Windows 7。它Grub 1.99已安装并且(希望这对我有帮助)rEFInd但它们都不起作用。我必须注意,Grub 它确实显示了 Windows 7 和 Ubuntu 的条目。Ubuntu 像它应该的那样启动,但是当我选择 Windows 时,屏幕告诉我:无效的 EFI 文件路径。

我尝试的另一个步骤是运行 Windows 7 修复 cd,输入命令提示符,重新分配驱动器号(对于 [OS],它们是 C:\,对于 [DATA],它们是 C:\),因此它们适合原始状态,然后是以下命令:
Bootrec.exe /FixMbr
Bootrec.exe /FixBoot
Bootrec.exe /ScanOs
Bootrec.exe /RebuildBcd
重新启动
但他们没有帮助,所以我尝试了以下操作:
bootsect /nt60 c: /force /mbr
bcdboot c:\windows /s c:
再次,没有 sigar。所以我开始进一步寻找并进入这个网站,它给出了我有点担心尝试的建议,因为我不知道可能的结果,我不想再次失去任何东西。

运行boot info script给了我以下输出(分区的顺序可能看起来很奇怪,我知道,但我认为这无关紧要:


                  Boot Info Script 0.61      [1 April 2012]


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

 => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 
    1880670208 of the same hard drive for core.img. core.img is at this 
    location and looks for (,gpt2)/boot/grub on this drive.

sda1: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  FAT32
    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:        /efi/refind/refind_x64.efi /efi/ubuntu/grubx64.efi 
                       /efi/ubuntu/shimx64.efi

sda2: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  Grub2 (v1.99)
    Boot sector info:  Grub2 (v1.99) is installed in the boot sector of sda2 
                       and looks at sector 1569963600 of the same hard drive 
                       for core.img. core.img is at this location and looks 
                       for (,gpt2)/boot/grub on this drive.
    Operating System:  Ubuntu 12.04.4 LTS
    Boot files:        /boot/grub/grub.cfg /etc/fstab

sda3: __________________________________________________________________________

    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:        

sda4: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /NST/menu.lst /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:        /bootmgr /boot/bcd

sda6: __________________________________________________________________________

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

sda7: __________________________________________________________________________

    File system:       BIOS Boot partition
    Boot sector type:  Grub2's core.img
    Boot sector info: 

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

Drive: sda _____________________________________________________________________

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1                   1 1,953,525,167 1,953,525,167  ee GPT


GUID Partition Table detected.

Partition    Start Sector    End Sector  # of Sectors System
/dev/sda1           2,048       194,559       192,512 EFI System partition
/dev/sda2   1,556,162,560 1,864,286,207   308,123,648 EFI System partition
/dev/sda3   1,233,352,704 1,556,162,559   322,809,856 Data partition (Windows/Linux)
/dev/sda4         194,560 1,233,352,703 1,233,158,144 Data partition (Windows/Linux)
/dev/sda5   1,880,690,688 1,936,979,967    56,289,280 Windows Recovery Environment (Windows)
/dev/sda6   1,864,286,208 1,880,670,207    16,384,000 Swap partition (Linux)
/dev/sda7   1,880,670,208 1,880,690,687        20,480 BIOS Boot partition

"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/sda1        E138-2A7D                              vfat       
/dev/sda2        598ab3d1-e1aa-4041-ba78-1de8c6762331   ext4       
/dev/sda3        4DFF26211F14E609                       ntfs       DATA
/dev/sda4        4A814AE3556AE075                       ntfs       OS
/dev/sda5        1B1666970F6A4336                       ntfs       Recovery
/dev/sda6        03dc7be8-7682-4219-8ab0-ae5d09caa1b1   swap       

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

Device           Mount_Point              Type       Options

/dev/sda1        /boot/efi                vfat       (rw)
/dev/sda2        /                        ext4       (rw,errors=remount-ro)


=========================== sda2/boot/grub/grub.cfg: ===========================

--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
set default="0"
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 recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
  insmod efi_gop
  insmod efi_uga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_gpt
insmod ext2
set root='(hd0,gpt2)'
search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_gpt
  insmod ext2
  set root='(hd0,gpt2)'
  search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30; then
  clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
    set gfxpayload="${1}"
    if [ "${1}" = "keep" ]; then
        set vt_handoff=vt.handoff=7
    else
        set vt_handoff=
    fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "${linux_gfx_mode}" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 3.8.0-35-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    gfxmode $linux_gfx_mode
    insmod gzio
    insmod part_gpt
    insmod ext2
    set root='(hd0,gpt2)'
    search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
    linux   /boot/vmlinuz-3.8.0-35-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro   quiet splash $vt_handoff
    initrd  /boot/initrd.img-3.8.0-35-generic
}
menuentry 'Ubuntu, with Linux 3.8.0-35-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod gzio
    insmod part_gpt
    insmod ext2
    set root='(hd0,gpt2)'
    search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
    echo    'Loading Linux 3.8.0-35-generic ...'
    linux   /boot/vmlinuz-3.8.0-35-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro recovery nomodeset 
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-3.8.0-35-generic
}
submenu "Previous Linux versions" {
menuentry 'Ubuntu, with Linux 3.8.0-29-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    gfxmode $linux_gfx_mode
    insmod gzio
    insmod part_gpt
    insmod ext2
    set root='(hd0,gpt2)'
    search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
    linux   /boot/vmlinuz-3.8.0-29-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro   quiet splash $vt_handoff
    initrd  /boot/initrd.img-3.8.0-29-generic
}
menuentry 'Ubuntu, with Linux 3.8.0-29-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod gzio
    insmod part_gpt
    insmod ext2
    set root='(hd0,gpt2)'
    search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
    echo    'Loading Linux 3.8.0-29-generic ...'
    linux   /boot/vmlinuz-3.8.0-29-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro recovery nomodeset 
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-3.8.0-29-generic
}
menuentry 'Ubuntu, with Linux 3.5.0-18-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    gfxmode $linux_gfx_mode
    insmod gzio
    insmod part_gpt
    insmod ext2
    set root='(hd0,gpt2)'
    search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
    linux   /boot/vmlinuz-3.5.0-18-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro   quiet splash $vt_handoff
    initrd  /boot/initrd.img-3.5.0-18-generic
}
menuentry 'Ubuntu, with Linux 3.5.0-18-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod gzio
    insmod part_gpt
    insmod ext2
    set root='(hd0,gpt2)'
    search --no-floppy --fs-uuid --set=root 598ab3d1-e1aa-4041-ba78-1de8c6762331
    echo    'Loading Linux 3.5.0-18-generic ...'
    linux   /boot/vmlinuz-3.5.0-18-generic root=UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 ro recovery nomodeset 
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-3.5.0-18-generic
}
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda4)" --class windows --class os {
    insmod part_gpt
    insmod ntfs
    set root='(hd0,gpt4)'
    search --no-floppy --fs-uuid --set=root 4A814AE3556AE075
    chainloader +1
}
menuentry "Windows Recovery Environment (loader) (on /dev/sda5)" --class windows --class os {
    insmod part_gpt
    insmod ntfs
    set root='(hd0,gpt5)'
    search --no-floppy --fs-uuid --set=root 1B1666970F6A4336
    drivemap -s (hd0) ${root}
    chainloader +1
}
set timeout_style=menu
if [ "${timeout}" = 0 ]; then
  set timeout=10
fi
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### 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 7" {
     insmod part_msdos
     insmod ntfs
     set root='(hd0,msdos4)'
     search --no-floppy --fs-uuid --set=root 4A814AE3556AE075
     chainloader +1
  }
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

=============================== sda2/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#                
proc            /proc           proc    nodev,noexec,nosuid 0       0
tmpfs /tmp tmpfs optional,nodev,noexec,nosuid 0 0
# / was on /dev/sda2 during installation
UUID=598ab3d1-e1aa-4041-ba78-1de8c6762331 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
#UUID=E138-2A7D  /boot/efi       vfat    defaults        0       1
# swap was on /dev/sda3 during installation
UUID=03dc7be8-7682-4219-8ab0-ae5d09caa1b1 none            swap    sw              0       0
#/dev/sda7 none swap sw,noauto 0 0
#UUID=E138-2A7D /boot/efi   vfat    defaults    0   1
#UUID=E138-2A7D /boot/efi   vfat    defaults    0   1
UUID=E138-2A7D  /boot/efi   vfat    defaults    0   1
--------------------------------------------------------------------------------

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

           GiB - GB             File                                 Fragment(s)

 814.208938599 = 874.250190848  boot/grub/grub.cfg                             1
 765.658302307 = 822.119342080  boot/initrd.img-3.5.0-18-generic               1
 743.588668823 = 798.422253568  boot/initrd.img-3.8.0-29-generic               2
 769.143566132 = 825.861615616  boot/initrd.img-3.8.0-35-generic               1
 765.462841034 = 821.909467136  boot/vmlinuz-3.5.0-18-generic                  2
 742.506031036 = 797.259780096  boot/vmlinuz-3.8.0-29-generic                  2
 769.006057739 = 825.713967104  boot/vmlinuz-3.8.0-35-generic                  1
 765.658302307 = 822.119342080  initrd.img                                     1
 765.658302307 = 822.119342080  initrd.img.old                                 1
 765.462841034 = 821.909467136  vmlinuz                                        2
 765.462841034 = 821.909467136  vmlinuz.old                                    2

============================== sda4/NST/menu.lst: ==============================

--------------------------------------------------------------------------------
# NeoSmart NeoGrub Bootloader Configuration File
#
# This is the NeoGrub configuration file, and should be located at C:\NST\menu.lst
# Please see the EasyBCD Documentation for information on how to create/modify entries:
# http://neosmart.net/wiki/display/EBCD/

--------------------------------------------------------------------------------

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

           GiB - GB             File                                 Fragment(s)

            ?? = ??             NST/menu.lst                                   0

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

xz: (stdin): Compressed data is corrupt
xz: (stdin): Compressed data is corrupt
Run Code Online (Sandbox Code Playgroud)

从 EXT4 分区中删除了引导标志。现在下一步是在C:\而不是EXT4分区中获取需要启动的windows分区。我在“cmd”中的 windows live cd 恢复环境中使用“diskpart”尝试了几次。但是,每次重新启动时,驱动器号都会重新分配。

我在一切都失控之前的设置

在此处输入图片说明

编辑:

用来自原始操作系统分区的副本替换了 bootmgfw.efi 文件。现在,当从 rEFInd 启动 Windows 7 时,我得到以下屏幕:


Windows failed to start. A recent hardware or software change might be the cause. To fix the problem:  

1. Insert your Windows installation disc and restart your computer.  
2. Choose your language settings, and click "Next."  
3. Click "Repair your computer."  

If you do not have this disc, contact your system administrator or computer manufacturer for assistance.  

File: \EFI\Microsoft\Boot\BCD  

Status: 0xc000000f  

Info: An error occurred while attempting to read the boot configuration data.  
Run Code Online (Sandbox Code Playgroud)

编辑 14 年 2 月 19 日



我在 Microsoft 的网站上找到了 Windows 8.1 试用版 ISO。下载了,安装在64位虚拟机上。将iso复制到虚拟磁盘并使用我发现的一些说明来使VM识别USB。然后通过其他说明,我找到了使其 EUFI 启动的方法并且它起作用了。

Now I'm waiting for the repair to be done. It's taking half an hour now and I don't know when it will be done. For the sake of reference I will be adding the sources of the information when/if this operation will be done

Rod*_*ith 5

您需要了解 BIOS 模式(又名 CSM 或传统模式)启动和 EFI 模式(又名 UEFI 模式)启动之间的区别。Windows 将这些启动模式与分区表类型密切相关:当且仅当磁盘使用旧的主引导记录 (MBR)分区表类型时,Windows 才会以 BIOS 模式启动,并且当且仅当磁盘使用旧的主引导记录 (MBR)分区表类型时,Windows 才会以 EFI 模式启动较新的GUID 分区表 (GPT)分区表类型。您的问题标题暗示您使用的是 GPT,但不清楚您的计算机最初是使用 GPT。(大多数 Windows 7 系统使用 BIOS 和 MBR,尽管有些 Windows 7 系统在 2011 年末销售并随后使用 EFI 和 GPT。)如果您的原始安装使用 BIOS/MBR,则需要安装 EFI 模式的 Windows 引导加载程序。此处描述此过程

如果您的计算机最初使用的是 EFI/GPT,您可能还需要重新安装引导加载程序;或者您可能忽略了一些关键细节,例如正确重新创建包含 EFI 引导加载程序的EFI 系统分区 (ESP)

如果您需要更多帮助,请尝试在 Linux 中运行引导信息脚本。这将生成一个名为RESULTS.txt. 将其发布到 pastebin 站点并在此处发布该文件的 URL。这将为我们提供有关您当前配置的更准确和详细的信息,这可能有助于修复它。


编辑:

您的引导信息脚本输出表明您的计算机上没有安装 Windows 引导加载程序。您必须修复它才能启动 Windows。特别是,由于磁盘使用 GPT,您必须为 Windows安装EFI引导加载程序。大多数描述 Windows 启动修复的页面都假定系统是基于 BIOS 的,因此对您来说 100% 没用。本页介绍了如何将 Windows 从 BIOS 模式启动转换为 EFI 模式启动,因此这些内容可能会起作用。可能还有其他页面会有所帮助;或者您可以在 Windows 论坛上发帖寻求帮助。

还有一点,您在尝试安装 Windows 引导加载程序之前可能需要处理:您/dev/sda2使用的是 ext4 文件系统,但被标记为EFI 系统分区 (ESP)。这是不正确的,可能会导致问题,所以你应该修复它。有多种方法可以做到这一点,具体取决于您使用的分区软件。例如,在 中gdisk,您应该使用t选项将类型代码从 EF00 更改为 8300 ,然后通过w选项写入更改。在partedGParted 中,您将删除“引导标志”(并在 GParted 中应用更改)。