操作系统启动疑难解答 - Windows 更新安装容量Troubleshoot OS start up - Windows Update installation capacity

本文提供了相关步骤来解决 Azure 虚拟机 (VM) 中 Windows 更新 (KB) 收到错误且无响应的问题。This article provides steps to resolve issues in an Azure virtual machine (VM) where Windows Update (KB) gets an error and becomes unresponsive.

症状Symptom

使用引导诊断查看 VM 的屏幕截图时,将看到屏幕截图显示 Windows 更新 (KB) 正在进行中,但却失败并显示错误代码:C01A001D。When you use Boot diagnostics to view the screenshot of the VM, you will see that the screenshot displays Windows Update (KB) in progress, but failing with the error code: C01A001D. 下图显示 Windows 更新 (KB) 停滞且出现“错误 C01A001D: 正在应用更新操作 #####/##### (######)”消息:The following image shows Windows Update (KB) stuck with the message "Error C01A001D applying update operation ##### of ##### (######)":

Windows 更新 (KB) 停滞且出现“错误 C01A001D: 正在应用更新操作 X/Y (Z)”消息。

原因Cause

在这种情况下,操作系统 (OS) 无法完成 Windows 更新 (KB) 安装,因为无法在文件系统上创建核心文件。In this situation, the operating system (OS) is unable to complete a Windows Update (KB) installation as a core file can't be created on the file system. 此错误代码指出操作系统无法将任何文件写入磁盘。Based on this error code, the operating system is unable to write any files to the disk.

解决方案Solution

流程概述:Process Overview:

  1. 创建和访问修复 VM。Create and access a Repair VM.
  2. 释放磁盘上的空间。Free space on disk.
  3. 启用串行控制台和内存转储集合。Enable serial console and memory dump collection.
  4. 重新生成 VM。Rebuild the VM.

备注

遇到此错误时,来宾操作系统无法正常运行。When encountering this error, the Guest OS is not operational. 在脱机模式下进行故障排除来解决此问题。Troubleshoot this issue 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.

释放磁盘上的空间Free Up Space on the disk

若要解决此问题:To solve the issue:

  • 如果磁盘尚未达到最大大小 1 TB,请将其大小调整为 1 TB。Resize the disk up to 1 TB if it is not already at the maximum size of 1 TB.
  • 执行磁盘清理。Perform a disk cleanup.
  • 对驱动器进行碎片整理。De-fragment the drive.
  1. 检查磁盘是否已满。Check if the disk is full. 如果磁盘大小小于 1 TB,请使用 PowerShell 将其扩展到最大 1 TB。If the disk size is below 1 TB, expand it up to a maximum of 1 TB using PowerShell.

  2. 如果磁盘已是 1 TB,则需要执行磁盘清理。If the disk is already 1 TB, you will need to perform a disk cleanup.

    1. 从已损坏的 VM 中分离数据磁盘。Detach the data disk from the broken VM.
    2. 将数据磁盘附加到正常运行的 VMAttach the data disk to a functioning VM.
    3. 使用磁盘清理工具来释放空间。Use the Disk Cleanup tool to free up space.
  3. 完成大小调整和清理后,使用以下命令对驱动器进行碎片整理:Once resizing and clean-up are finished, de-fragment the drive using the following command:

    defrag <LETTER ASSIGN TO THE OS DISK>: /u /x /g
    

碎片整理可能需要几个小时,具体取决于碎片级别。Depending upon the level of fragmentation, de-fragmentation could take several hours.

启用串行控制台和内存转储集合Enable the Serial Console and memory dump collection

建议:在重新生成 VM 之前,通过运行以下脚本来启用串行控制台和内存转储收集:Recommended: Before you rebuild the VM, enable the Serial Console and memory dump collection by running the following script:

  1. 以管理员身份打开权限提升的命令提示符会话。Open an elevated command prompt session as an Administrator.

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

    启用串行控制台Enable the 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 larger than the memory size (RAM) on the VM.

    如果 OS 磁盘上没有足够的空间,请更改将要创建内存转储文件的位置,并将该位置引用到具有足够可用空间的 VM 上附加的任何数据磁盘。If there's not enough space on the OS disk, change the location where the memory dump file will be created, and refer that location 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 of the data disk, such as F:, in the following commands.

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

    加载损坏的 OS 磁盘:Load the 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 VM

使用 VM 修复命令的步骤 5 重新生成 VM。Use step 5 of the VM Repair Commands to rebuild the VM.