启动错误 - 这不是可启动磁盘Boot Error - This is not a Bootable Disk

本文提供的步骤用于解决无法在 Azure 虚拟机 (VM) 中启动磁盘的问题。This article provides steps to resolve issues where the disk isn't bootable in an Azure Virtual Machine (VM).

症状Symptoms

使用启动诊断查看 VM 的屏幕截图时,会看到屏幕截图显示一个提示,其消息为“这不是可启动磁盘。When you use Boot diagnostics to view the screenshot of the VM, you'll see that the screenshot displays a prompt with the message 'This is not a bootable disk. 请插入可启动软盘并按任意键重试…”。Please insert a bootable floppy and press any key to try again...'.

图 1Figure 1

图 1 显示了消息“这不是可启动磁盘。*

原因Cause

出现此错误消息表示 OS 引导进程找不到活动的系统分区。This error message means the OS boot process couldn't locate an active system partition. 此错误还可能表示引导配置数据 (BCD) 存储中缺少引用,这会阻止它查找 Windows 分区。This error could also mean that there's a missing reference in the Boot Configuration Data (BCD) store, preventing it from locating the Windows partition.

解决方案Solution

流程概述Process Overview

  1. 创建并访问修复 VM。Create and Access a Repair VM.

  2. 将“分区状态”设置为“活动”。Set Partition Status to Active.

  3. 修复磁盘分区。Fix the Disk Partition.

  4. 建议 :在重建 VM 之前,启用串行控制台和内存转储收集。Recommended : Before you rebuild the VM, enable serial console and memory dump collection.

  5. 重建原始 VM。Rebuild the Original VM.

    备注

    遇到此启动错误时,来宾 OS 不会正常运行。When encountering this boot error, the Guest OS isn't operational. 需要在脱机模式下进行故障排除才能解决此问题。You'll be troubleshooting in offline mode to resolve this issue.

创建并访问修复 VMCreate and Access a Repair VM

  1. 使用 VM 修复命令的步骤 1-3 来准备一个修复 VM。Use steps 1-3 of the VM Repair Commands to prepare a Repair VM.
  2. 使用远程桌面连接来连接到修复 VM。Using Remote Desktop Connection connect to the Repair VM.

将“分区状态”设置为“活动”Set Partition Status to Active

第 1 代 VM 会先验证 BCD 存储所在的 OS 分区是否已标记为“活动” 。Generation 1 VMs should first verify that the OS partition, which holds the BCD store is marked as active . 如果使用第 2 代 VM,请跳转到修复磁盘分区,因为在更高的代系中,“状态”标志已弃用 。If you have a Generation 2 VM, skip ahead to Fix the Disk Partition, as the Status flag was deprecated in the later generation.

  1. 打开提升的命令提示符 (cmd.exe) 。Open an elevated command prompt (cmd.exe) .

  2. 输入 diskpart 以启动 DISKPART 工具 。Enter diskpart to launch the DISKPART tool.

  3. 输入 list disk 以列出系统上的磁盘,确定附加的 OS VHD 。Enter list disk to list the disks on the system and identify the attached OS VHD.

  4. 找到附加的 OS VHD 后,输入 sel disk # 来选择磁盘 。Once the attached OS VHD is located, enter sel disk # to select the disk. 请参阅图 2,其中的“磁盘 1”是附加的 OS VHD。See Figure 2, where Disk 1 is the attached OS VHD.

    图 2Figure 2

    图 2 显示了“DISKPART”窗口,其中显示了 list disk 命令的输出,表中显示了“磁盘 0”和“磁盘 1”。**

  5. 选择磁盘后,输入 list partition 以列出所选磁盘的分区 。Once the disk is selected, enter list partition to list the partitions of the selected disk.

  6. 确定启动分区后,输入 sel partition # 以选择该分区 。Once the boot partition is identified, enter sel partition # to select the partition. 通常,启动分区的大小约为 350 MB。Usually the boot partition will be around 350 MB in size. 请参阅图 3,其中的“分区 1”是启动分区。See Figure 3, where Partition 1 is the boot partition.

    图 3Figure 3

    图 3 显示了“DISKPART”窗口,其中包含 list partition 命令的输出。****

  7. 输入“detail partition”,检查分区状态。Enter 'detail partition' to check the status of the partition. 请参阅图 4,其中的分区为“活动: 否”;或参阅图 5,其中的分区为“活动:是”。See Figure 4, where the partition is Active: No , or Figure 5, where the partition is 'Active: Yes'.

    图 4Figure 4

    图 4 显示了“DISKPART”窗口,其中包含 detail partition 命令的输出,“分区 1”设置为“活动:*****否*

    图 5Figure 5

    图 5 显示了“DISKPART”窗口,其中包含 detail partition 命令的输出,“分区 1”设置为“活动:******是”。

  8. 如果分区为“非活动”,请输入 active 来更改“活动”标志 。If the partition is Not Active , enter active to change the Active flag.

  9. 键入 detail partition,检查是否正确完成了状态更改 。Check that the status change was done properly by typing detail partition .

    图 6Figure 6

    图 6 显示了“diskpart”窗口,其中包含 detail partition 命令的输出,“分区 1”设置为“活动:**是

  10. 输入 exit,关闭 DISKPART 工具并保存配置更改 。Enter exit to close the DISKPART tool and save your configuration changes.

修复磁盘分区Fix the Disk Partition

  1. 打开提升的命令提示符 (cmd.exe)。Open an elevated command prompt (cmd.exe).

  2. 使用以下命令在磁盘上运行 CHKDSK 并修复错误 :Use the following command to run CHKDSK on the disk(s) and fix errors:

    chkdsk <DRIVE LETTER>: /f

    添加“/f”命令选项会修复磁盘上的任何错误。Adding the '/f' command option will fix any errors on the disk. 请务必将 替换为附加的 OS VHD 的盘符。Make sure to replace with the letter of the attached OS VHD.

若要启用内存转储收集和串行控制台,请运行以下脚本:To enable memory dump collection and Serial Console, run the following script:

  1. 打开提升的命令提示符会话(以管理员身份运行)。Open an elevated command prompt session (Run as administrator).

  2. 运行以下命令:Run the following commands:

    启用串行控制台Enable Serial Console

    bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /ems {<BOOT LOADER IDENTIFIER>} ON

    bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /emssettings EMSPORT:1 EMSBAUDRATE:115200

  3. 验证 OS 磁盘上的可用空间是否与 VM 上的内存大小 (RAM) 相当。Verify that the free space on the OS disk is as much as the memory size (RAM) on the VM.

    如果 OS 磁盘上没有足够的空间,则应更改内存转储文件的创建位置,将其指向任何已附加到 VM 且具有足够可用空间的数据磁盘。If there's not enough space on the OS disk, you should change the location where the memory dump file will be created and refer that to any data disk attached to the VM that has enough free space. 若要更改位置,请将以下命令中的“%SystemRoot%”替换为数据磁盘的驱动器号(例如“F:”)。To change the location, replace "%SystemRoot%" with the drive letter (for example, "F:") of the data disk in the below commands.

用于启用 OS 转储的建议配置Suggested configuration to enable OS Dump

加载损坏的 OS 磁盘Load Broken OS Disk :

REG LOAD HKLM\BROKENSYSTEM <VOLUME LETTER OF BROKEN OS DISK>:\windows\system32\config\SYSTEM

在 ControlSet001 上启用:Enable on ControlSet001:

REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f

REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f

REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f

在 ControlSet002 上启用:Enable on ControlSet002:

REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f

REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f

REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f

卸载损坏的 OS 磁盘:Unload Broken OS Disk:

REG UNLOAD HKLM\BROKENSYSTEM

重建原始 VMRebuild the Original VM

使用 VM 修复命令的步骤 5 重新装配 VM。Use step 5 of the VM Repair Commands to reassemble the VM.