将MBR启动的Windows 7转换为UEFI启动
关键词: UEFI, BCD, BCDEDIT, GPT
最近连续发生过几次,要修复Windows 7启动菜单的事情,每次都搞得焦头烂额。
案例一: 在同一GPT硬盘上的另外分区重新抹除了Mac OSX的分区,导致硬盘分区从GPT转为MBR格式,Windows 7已经无法正确识别分区,启动自然就不停的报BCD菜单错误,无法进入。
案例二:随机安装的Windows 7为MBR方式启动的,在把硬盘转换为GPT格式后,启动方式就要转换为UEFI启动模式,不然系统根本无法启动。
因此,对于我这种不愿升级Windows 8/10的懒鬼来说,寻求一种适用于Windows 7的安全稳妥,且快捷的BCD菜单恢复方式势在必行。
说明: 对于混合硬盘模式如何转回GPT,可以通过Parted或者Diskgnius来转回来,也可以通过dd将磁盘的Protective MBR区恢复回去的方式来处理。基本上都是无损的,仔细点,一般不会弄丢数据的。
对于BCD的Store和菜单恢复,就没那么容易了,特别是在MBR方式到EFI方式启动的转换过程中。
对于这个问题,尝试用BOOTICE来修复,但是生成的Store和表项,Windows 7根本无法识别,总是报Invalid的GUID或0x00...0024之类的错误。另外各种autofix或者UEFI修复工具,就更是扯淡了。
但经过多次努力,最后终于成功将MBR引导的Windows转换为UEFI模式启动,将Windows 7重新恢复到GPT硬盘上,彻底解决了多系统并存的启动问题。
问题的解决方式记录如下:
1, 通过ImageX将Windows 7安装分区备份出来。
2, 将硬盘转换为GPT格式的,重新划分分区,EFI, MSR,和windows系统分区。
3, 引导Win 7 PE,通过ImageX将备份好的系统恢复到Windows系统分区。
4, 格式化EFI分区为FAT格式。
5, 将\Windows\Boot下的EFI目录复制到EFI分区。目录结构应该为
【EFI】\EFI\Microsoft\boot\
6, 通过EFI方式引导Windows 7的原始安装盘,选择对应语言zh-CN或者us-EN,进入系统修复界面。
7, 【关键点】,尝试通过系统自动修复,通常都是不成功的。需要进行手动修复。
a, Shift + F10,进入命令行模式
b, 挂载EFI分区
diskpart
select disk 0
select part 1
assign letter=G:
这步后,EFI分区就挂在G:下了。
c, 进入EFI\microsoft\boot目录,确认BCD有没存在。如果有直接删除。
cd EFI\microsoft\boot
attrib -s -h -r bcd
del bcd
d, bootrec /rebuildbcd
之后,无须做任何动作,检查下当前目录有新生成的Store, 在EFI\Boot目录下,有新复制的bootx64.efi文件即可。
8, 重新启动计算机,通过EFI文件的方式bootx64.efi引导windows, 成功!
任何bcdboot,bootice等工具都尝试过,根本无法解决连BCD都不存在的问题。
======
当然了,如果愿意,也可以通过Win 7 PE引导的方式,完全重建BCD。这种方式有尝试过,不一定能成功。通过Win PE修复,必须带-store参数,选择正确的BCD。
Create a new system store, as in the following example:
bcdedit -createstore S:\EFI\Microsoft\Boot\BCD
Create new entries in the system store for bootmgr, globalsettings, dbgsettings, ramdiskoptions, and Windows 7.
bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {bootmgr} /d "Boot Manager"
bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {globalsettings} /d "globalsettings"
bcdedit -store S:\EFI\Microsoft\Boot\BCD -create /d "Windows 7" -application osloader
Set the default entry that the boot manager selects when the timeout expires. Substitute <GUID> with the GUID value for the Windows PE store in the following example:
bcdedit -store S:\EFI\Microsoft\Boot\BCD /default <GUID from Windows 7 store>
Run the following commands to configure bootmgr:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} device partition=s:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} path \EFI\Microsoft\Boot\bootmgfw.efi
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} locale en-us
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} timeout 10
Run the following commands to configure the boot loader:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} device partition=C:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} path \windows\system32\winload.efi
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} osdevice partition=C:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} systemroot \windows
bcdedit -store S:\EFI\Microsoft\Boot\BCD -displayorder {Default} -addfirst
Your computer is now ready to boot Windows 7 directly from the hard disk.
最近连续发生过几次,要修复Windows 7启动菜单的事情,每次都搞得焦头烂额。
案例一: 在同一GPT硬盘上的另外分区重新抹除了Mac OSX的分区,导致硬盘分区从GPT转为MBR格式,Windows 7已经无法正确识别分区,启动自然就不停的报BCD菜单错误,无法进入。
案例二:随机安装的Windows 7为MBR方式启动的,在把硬盘转换为GPT格式后,启动方式就要转换为UEFI启动模式,不然系统根本无法启动。
因此,对于我这种不愿升级Windows 8/10的懒鬼来说,寻求一种适用于Windows 7的安全稳妥,且快捷的BCD菜单恢复方式势在必行。
说明: 对于混合硬盘模式如何转回GPT,可以通过Parted或者Diskgnius来转回来,也可以通过dd将磁盘的Protective MBR区恢复回去的方式来处理。基本上都是无损的,仔细点,一般不会弄丢数据的。
对于BCD的Store和菜单恢复,就没那么容易了,特别是在MBR方式到EFI方式启动的转换过程中。
对于这个问题,尝试用BOOTICE来修复,但是生成的Store和表项,Windows 7根本无法识别,总是报Invalid的GUID或0x00...0024之类的错误。另外各种autofix或者UEFI修复工具,就更是扯淡了。
但经过多次努力,最后终于成功将MBR引导的Windows转换为UEFI模式启动,将Windows 7重新恢复到GPT硬盘上,彻底解决了多系统并存的启动问题。
问题的解决方式记录如下:
1, 通过ImageX将Windows 7安装分区备份出来。
2, 将硬盘转换为GPT格式的,重新划分分区,EFI, MSR,和windows系统分区。
3, 引导Win 7 PE,通过ImageX将备份好的系统恢复到Windows系统分区。
4, 格式化EFI分区为FAT格式。
5, 将\Windows\Boot下的EFI目录复制到EFI分区。目录结构应该为
【EFI】\EFI\Microsoft\boot\
6, 通过EFI方式引导Windows 7的原始安装盘,选择对应语言zh-CN或者us-EN,进入系统修复界面。
7, 【关键点】,尝试通过系统自动修复,通常都是不成功的。需要进行手动修复。
a, Shift + F10,进入命令行模式
b, 挂载EFI分区
diskpart
select disk 0
select part 1
assign letter=G:
这步后,EFI分区就挂在G:下了。
c, 进入EFI\microsoft\boot目录,确认BCD有没存在。如果有直接删除。
cd EFI\microsoft\boot
attrib -s -h -r bcd
del bcd
d, bootrec /rebuildbcd
之后,无须做任何动作,检查下当前目录有新生成的Store, 在EFI\Boot目录下,有新复制的bootx64.efi文件即可。
8, 重新启动计算机,通过EFI文件的方式bootx64.efi引导windows, 成功!
任何bcdboot,bootice等工具都尝试过,根本无法解决连BCD都不存在的问题。
======
当然了,如果愿意,也可以通过Win 7 PE引导的方式,完全重建BCD。这种方式有尝试过,不一定能成功。通过Win PE修复,必须带-store参数,选择正确的BCD。
Create a new system store, as in the following example:
bcdedit -createstore S:\EFI\Microsoft\Boot\BCD
Create new entries in the system store for bootmgr, globalsettings, dbgsettings, ramdiskoptions, and Windows 7.
bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {bootmgr} /d "Boot Manager"
bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {globalsettings} /d "globalsettings"
bcdedit -store S:\EFI\Microsoft\Boot\BCD -create /d "Windows 7" -application osloader
Set the default entry that the boot manager selects when the timeout expires. Substitute <GUID> with the GUID value for the Windows PE store in the following example:
bcdedit -store S:\EFI\Microsoft\Boot\BCD /default <GUID from Windows 7 store>
Run the following commands to configure bootmgr:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} device partition=s:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} path \EFI\Microsoft\Boot\bootmgfw.efi
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} locale en-us
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} timeout 10
Run the following commands to configure the boot loader:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} device partition=C:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} path \windows\system32\winload.efi
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} osdevice partition=C:
bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} systemroot \windows
bcdedit -store S:\EFI\Microsoft\Boot\BCD -displayorder {Default} -addfirst
Your computer is now ready to boot Windows 7 directly from the hard disk.
还没人转发这篇日记