Troubleshoot boot error - disk read error occurred

Applies to: ✔️ Windows VMs

This article provides steps to resolve issues in which the disk can't be read in an Azure virtual machine (VM).

Symptoms

When you use Boot diagnostics to view the screenshot of the VM, you see that the screenshot displays a prompt that contains the message "A disk read error occurred. Press Ctrl+Alt+Del to restart."

Screenshot of A disk read error occurred message.

Cause

This error message indicates that the disk structure is corrupted and unreadable. If you're using a Generation 1 VM, it's also possible that the disk partition containing the boot configuration data isn't set to Active.

Solution

Process overview

Tip

If you have a recent backup of the VM, you may try restoring the VM from the backup to fix the boot problem.

  1. Create and Access a Repair VM.
  2. Select a Solution:
  3. Enable serial console and memory dump collection.
  4. Rebuild the VM.

Note

When encountering this boot error, the Guest operating system (OS) is not operational. You'll be troubleshooting in offline mode to resolve this issue.

Create and access a repair VM

  1. Use steps 1-3 of the VM Repair Commands to prepare a Repair VM.
  2. Using Remote Desktop Connection, connect to the Repair VM.

Set partition status to active

Note

This mitigation applies only for Generation 1 VMs. Generation 2 VMs (using UEFI) don't use an active partition.

  1. Delete the VM. Make sure that you select the Keep the disks option when you do this.

  2. Attach the OS disk as a data disk to another VM (a troubleshooting VM). For more information, see How to attach a data disk to a Windows VM in the Azure portal.

  3. Connect to the troubleshooting VM. Open Computer management > Disk management. Make sure that the OS disk is online and that its partitions have drive letters assigned.

  4. Identify the Boot partition and Windows partition. If there's only one partition on the OS disk, this partition is both Boot partition and Windows partition.

    If the OS disk contains more than one partition, you can identify the partitions by viewing the folders in them:

    • The Windows partition contains a folder that is named Windows, and this partition is larger than the others.

    • The Boot partition contains a folder that is named Boot. This folder is hidden by default. To see the folder, you must display the hidden files and folders and disable the Hide protected operating system files (Recommended) option. The boot partition is typically 300 MB~500 MB.

  5. Run the following command as an administrator to create a boot record:

    bcdboot <Windows partition>:\Windows /S <windows partition>: 
    
  6. Use the DISKPART tool to check whether the Windows partition is active:

    1. Open an elevated command prompt and open the DISKPART tool.

      diskpart

    2. List the disks on the system and look for added disks and proceed to select the new disk. In this example, the new disk is Disk 1.

      list disk
      sel disk 1
      

      The diskpart window shows outputs of list disk and sel disk 1 commands. Disk 0 and Disk 1 are displayed in the table. Disk 1 is the selected disk.

    3. List all the partitions on that disk and then proceed to select the partition you want to check. Usually System Managed partitions are smaller and around 350 MB in size. In the following image, this partition is Partition 1.

      list partition
      sel partition 1
      

      The diskpart window shows outputs of list partition and sel partition 1 commands. Partition 1 is the selected disk.

    4. Check the status of the partition. In our example, Partition 1 is not active.

      detail partition

      The diskpart window with output of the detail partition command where Partition 1 is not active.

      If the partition isn't active, change the Active flag and then recheck the change was done properly.

      active
      detail partition
      

      The diskpart window with output of the detail partition command where Partition 1 is active.

    5. Exit the DISKPART tool.

      exit

Fix the disk partition

  1. Open an elevated command prompt (cmd.exe).

  2. Use the following command to run CHKDSK on the disk(s) and perform error fixes:

    chkdsk <DRIVE LETTER>: /f

    Adding the /f command option fixes any errors on the disk. Make sure to replace < DRIVE LETTER > with the letter of the attached OS VHD.

Enable the serial console and memory dump collection

Important

This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For protection, back up the registry before you modify it so that you can restore it if a problem occurs. For more information about how to back up and restore the registry, see How to back up and restore the registry in Windows.

Recommended: Before you rebuild the VM, enable the Serial Console and memory dump collection by following these steps:

  1. Open an elevated command prompt session as an administrator.

  2. Run the following BCDEdit commands using the /ems and /emssettings options:

    Enable the serial console:

    bcdedit /store <volume-letter-containing-the-bcd-folder>:\boot\bcd /ems {<boot-loader-identifier>} ON
    bcdedit /store <volume-letter-containing-the-bcd-folder>:\boot\bcd /emssettings EMSPORT:1 EMSBAUDRATE:115200
    
  3. Verify that the free space on the OS disk is larger than the memory size (RAM) on the VM.

    If there isn't enough space on the OS disk, change the location where the memory dump file is created, and refer that location to any data disk attached to the VM that has enough free space. To change the location, replace %SystemRoot% with the drive letter of the data disk, such as F:, in the following commands.

    To enable the OS dump file, run the following load, add, and unload commands to implement the suggested configuration using the reg tool:

    Load the registry hive from the broken OS disk:

    reg load HKLM\<broken-system> <volume-letter-of-broken-os-disk>:\windows\system32\config\SYSTEM
    

    Enable on ControlSet001:

    reg add "HKLM\<broken-system>\ControlSet001\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f
    reg add "HKLM\<broken-system>\ControlSet001\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
    reg add "HKLM\<broken-system>\ControlSet001\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
    

    Enable on ControlSet002:

    reg add "HKLM\<broken-system>\ControlSet002\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f
    reg add "HKLM\<broken-system>\ControlSet002\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f
    reg add "HKLM\<broken-system>\ControlSet002\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f
    

    Unload the broken OS disk:

    reg unload HKLM\<broken-system>
    

Rebuild the VM

Use step 5 of the VM Repair Commands to rebuild the VM.

Contact us for help

If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.