This topic describes why a Windows instance might fail to start and enter "Preparing Automatic Repair" mode, and how to resolve the issue.
Symptoms
When you start a Windows instance, the operating system fails to load and enters repair mode, displaying a "Preparing Automatic Repair" message.

Causes
This issue has several possible causes. Use the instance health diagnostics tool to identify the specific cause, and then find the corresponding solution in the table below. For more information about how to use the instance health diagnostics tool, see Use the self-service troubleshooting feature to resolve instance issues.
Diagnostic message | Solution |
The Windows partition of the instance does not exist or some files are missing, which prevents the operating system from starting. | This issue typically occurs when an instance created from a problematic custom image fails to start. To resolve this, create a new image and use it to replace the operating system of the instance. For more information, see Create a Windows image and replace system disk. |
The file system of the Windows partition is not NTFS, which prevents the operating system from starting. | |
The disk space allocated to the Windows partition is too small (less than 20 GB), which prevents the operating system from starting. | You can extend the disk. For more information, see Extend partitions and file systems for a Windows instance. |
The Windows partition of the instance is read-only, which prevents the operating system from starting. | |
The Windows partition of the instance is hidden, which prevents the operating system from starting. | |
A critical registry file of the instance is missing, which prevents the operating system from starting. | |
A critical registry file of the instance is corrupted, which prevents the operating system from starting. | |
The Boot Configuration Data (BCD) file of the instance is missing, which prevents the operating system from starting. | |
The content of the Boot Configuration Data (BCD) file is corrupted, which prevents the operating system from starting. | |
The Windows Boot Manager (BootMgr) file is missing, which prevents the operating system from starting. | |
The content of the Windows Boot Manager (BootMgr) file is corrupted, which prevents the operating system from starting. | |
The boot device or disk specified in the Windows Boot Manager (BootMgr) configuration does not exist, which prevents the operating system from starting. | |
The bootloader of the instance is missing, which prevents the operating system from starting. |
Clear the read-only attribute of the Windows partition
To clear the read-only attribute of the Windows partition, attach a repair disk to the affected instance and follow these steps:
-
Connect to the faulty instance.
On the Diagnostic Result page, click VNC Connection. Then, enter the Administrator username and password provided in the diagnostic report to log on to the ECS instance to which a repair disk is attached. For more information, see Connect using VNC.
Clear the read-only attribute of the Windows partition.
You can use one of the following methods.
DiskPart utility
Assume that the drive letter of the target partition is D. Perform the following steps:
Open the
DiskPartwindow.Type
diskpartin the search box, or openWindows PowerShelland run thediskpartcommand.Select the target volume.
select volume DClear the read-only attribute.
attribute volume clear readonly
PowerShell command
In this example, the disk number is 1 and the target partition number is 1.
Set-Partition -DiskNumber 1 -PartitionNumber 1 -IsReadOnly $false-
On the Instance page, move the pointer over the Fixing state that corresponds to the instance and click Detach Repair Disk.
-
Restart the instance to allow the preceding configurations to take effect.
For more information, see Restart an instance.
-
Connect to the ECS instance. If you can connect to the ECS instance as expected, the preceding issue is resolved.
For more information, see Connect to Windows.
Clear the hidden attribute of the Windows partition
To clear the hidden attribute of the Windows partition, attach a repair disk to the affected instance and follow these steps:
-
Connect to the faulty instance.
On the Diagnostic Result page, click VNC Connection. Then, enter the Administrator username and password provided in the diagnostic report to log on to the ECS instance to which a repair disk is attached. For more information, see Connect using VNC.
Clear the hidden attribute of the Windows partition. In this example, the disk number of the affected system disk is 0, and the hidden partition number is 1.
You can use one of the following methods.
DiskPart utility
Open the
DiskPartwindow.Type
diskpartin the search box, or openWindows PowerShelland run thediskpartcommand.Select the target disk.
select disk 0Select the hidden partition.
select partition 1Clear the hidden attribute.
attribute volume clear hidden
PowerShell command
Run the following command in Windows PowerShell:
Set-Partition -DiskNumber 0 -PartitionNumber 1 -IsHidden $false-
On the Instance page, move the pointer over the Fixing state that corresponds to the instance and click Detach Repair Disk.
-
Restart the instance to allow the preceding configurations to take effect.
For more information, see Restart an instance.
-
Connect to the ECS instance. If you can connect to the ECS instance as expected, the preceding issue is resolved.
For more information, see Connect to Windows.
Repair a corrupted registry file
Method 1: Repair in repair mode
When the instance enters repair mode, click Startup Repair to fix the startup failure.

Choose a repair method based on whether a registry backup exists.
If a registry backup exists, use the backup to replace the corrupted registry file.
NoteBy default, registry backups are stored in
C:\Windows\System32\config\regback.If no registry backup is available, use one of the following methods to attempt a repair:
Run the
dism /Image:D: /Cleanup-image /Restorehealthcommand.Run the
sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows /offlogfile=C:\sfclog.txtcommand.
-
Connect to the ECS instance. If you can connect to the ECS instance as expected, the preceding issue is resolved.
For more information, see Connect to Windows.
Method 2: Use a repair disk
To repair the corrupted registry file, attach a repair disk to the affected instance and follow these steps. This example assumes the mounted disk is drive D.
-
Connect to the faulty instance.
On the Diagnostic Result page, click VNC Connection. Then, enter the Administrator username and password provided in the diagnostic report to log on to the ECS instance to which a repair disk is attached. For more information, see Connect using VNC.
Choose a repair method based on whether a registry backup exists.
If a registry backup exists, use the backup to replace the corrupted registry file.
NoteBy default, registry backups are stored in
D:\Windows\System32\config\regback.If no registry backup is available, use one of the following methods to attempt a repair:
Run the
dism /Image:D: /Cleanup-image /Restorehealthcommand.Run the
sfc /scannow /offbootdir=D:\ /offwindir=D:\Windows /offlogfile=C:\sfclog.txtcommand.
-
Connect to the ECS instance. If you can connect to the ECS instance as expected, the preceding issue is resolved.
For more information, see Connect to Windows.
Configure Windows boot settings
If the instance fails to start due to an incorrect boot configuration, attach a repair disk to the instance to reconfigure the boot settings.
-
Connect to the faulty instance.
On the Diagnostic Result page, click VNC Connection. Then, enter the Administrator username and password provided in the diagnostic report to log on to the ECS instance to which a repair disk is attached. For more information, see Connect using VNC.
Run Command Prompt as an administrator.
Use the BCDboot tool to reconfigure the boot settings.
The command varies based on the boot mode. Assume that the drive letter of the system partition is S and the drive letter of the Windows partition is C. The commands are as follows:
BIOS boot mode:
bcdboot C:\Windows /s S:UEFI boot mode:
bcdboot C:\Windows /s S: /f UEFINoteIf a bootable Windows system is available on drive D in addition to drive C, you can configure multiple boot entries. Use the following commands:
BIOS boot mode:
bcdboot D:\Windows /s S: /d /p /addlastUEFI boot mode:
bcdboot D:\Windows /s S: /d /p /addlast /f UEFI
After the configuration is complete, use the following command to view the boot entries.
BIOS boot mode:
bcdedit /store S:\Boot\BCDUEFI boot mode:
bcdedit /store S:\EFI\Microsoft\Boot\BCDA message similar to the one in the following figure indicates that the boot entries were configured successfully.

-
On the Instance page, move the pointer over the Fixing state that corresponds to the instance and click Detach Repair Disk.
-
Start the ECS instance.
For more information, see Start an instance.