Windows UEFI 转 BIOS 操作流程
Posted Carlton Xu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Windows UEFI 转 BIOS 操作流程相关的知识,希望对你有一定的参考价值。
1. 将UEFI类型卷挂载到linux操作系统
windows 2008、windows2016 均通过测试可行,其他操作系统版本待测试。(阿里云平台测试通过)
1.2. GPT转MBR操作
### 源GPT分区信息
[root@centos7-transfer ~]# parted /dev/vdd print
Model: Virtio Block Device (virtblk)
Disk /dev/vdd: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 473MB 472MB ntfs Basic data partition hidden, diag
2 473MB 578MB 105MB fat32 EFI system partition boot
3 578MB 595MB 16.8MB Microsoft reserved partition msftres
4 595MB 42.9GB 42.4GB ntfs Basic data partition
1.2.1 执行转换动作
注意:第一个启动分区,一般为fat32,需要格式化为ntfs分区,并且将第一个启动分区Code更改为0700标准的Basic data partition,并添加boot flag,需要通过fdisk t 来修改分区的type code为07
gdisk指令需要安装包,yum install -y gdisk
[root@centos7-transfer ~]# gdisk /dev/vdd
GPT fdisk (gdisk) version 0.8.10
The protective MBR's 0xEE partition is oversized! Auto-repairing.
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/vdd: 83886080 sectors, 40.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 7C6851BB-9502-4194-A24F-14D52C03AAE8
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 83886046
Partitions will be aligned on 2048-sector boundaries
Total free space is 4029 sectors (2.0 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 923647 450.0 MiB 2700 Basic data partition
2 923648 1128447 100.0 MiB EF00 EFI system partition
3 1128448 1161215 16.0 MiB 0C01 Microsoft reserved ...
4 1161216 83884031 39.4 GiB 0700 Basic data partition
Command (? for help): r
Recovery/transformation command (? for help): g
MBR command (? for help): ?
a toggle the active/boot flag
c recompute all CHS values
l set partition as logical
o omit partition
p print the MBR partition table
q quit without saving changes
r set partition as primary
s sort MBR partitions
t change partition type code
w write the MBR partition table to disk and exit
MBR command (? for help): a
Toggle active flag for partition: 1
MBR command (? for help): w
Converted 4 partitions. Finalize and exit? (Y/N): y
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
[root@centos7-transfer ~]# parted /dev/vdd print
Model: Virtio Block Device (virtblk)
Disk /dev/vdd: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 473MB 472MB primary ntfs boot, diag
2 473MB 578MB 105MB primary fat32
3 578MB 595MB 16.8MB primary lba
4 595MB 42.9GB 42.4GB primary ntfs
1.2.2. 删除多余分区(ESP、EFI)
删除第一个启动分区的diag隐藏分区flags
[root@centos7-transfer ~]# mkfs.ntfs /dev/vdb1 # 需要安装ntfsprogs包才可以
[root@centos7-transfer ~]# parted /dev/vdd -s rm 2
[root@centos7-transfer ~]# parted /dev/vdd -s rm 3
[root@centos7-transfer ~]# parted /dev/vdd -s toggle 1 diag
[root@centos7-transfer ~]# parted /dev/vdd print
Model: Virtio Block Device (virtblk)
Disk /dev/vdd: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 473MB 472MB primary ntfs boot
4 595MB 42.9GB 42.4GB primary ntfs
1.2.3. 目录扫描修复
# ntfsfix /dev/vdd1
# ntfsfix /dev/vdd4
1.2.4. 执行驱动适配
驱动适配动作可以放到同架构windows下进行
(1)拷贝驱动文件到指定目录下。
(2)使用reg load指令加载bcd
(3)reg add指令添加所需驱动文件及注册表。
# minitgt-fix /dev/vdd
2. 挂载卷到windows机器进行bcd修复
2.1. 创建启动文件
从系统分区模版拷贝bcd启动镜像到指定boot分区
bcdboot e:\\windows /s d: # bcdboot <windows系统分区> /s <Boot分区>
2.2. 修复启动配置数据
查看bcd启动配置数据
# bcdedit /store <Boot partition>:\\boot\\bcd /enum
执行磁盘主引导mbr分区修复
目标发现阿里云的windows 2008 R2 英文版本没有bootsect程序指令,需要进行移植使用,bootsect没有以来库文件,可以提前保存在迁移的环境中,检查如果修复的windows 没有此指令,就copy上使用,默认指令在 C:\\windows\\system32\\ 目录下
bootsect /nt60 d: /mbr # bootsect /nt60 <Boot partition>: /mbr
需要重建MBR主引导才可以正常启动
以上是关于Windows UEFI 转 BIOS 操作流程的主要内容,如果未能解决你的问题,请参考以下文章