Skip to content

Commit 9b5d5de

Browse files
authored
Merge pull request #8419 from MashaMSFT/2025_sqlvm
AB#4646 & AB#4647: Staging SQL installation failure error on Azure VMs
2 parents 59f7390 + b446098 commit 9b5d5de

9 files changed

Lines changed: 156 additions & 0 deletions

File tree

43.4 KB
Loading
27.7 KB
Loading
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: SQL Server Installation Fails with Sector Size Error on Azure VM
3+
description: Resolves the error (Cannot use file master.mdf because it was originally formatted with sector size 4096) when you try to install a SQL Server instance on an Azure VM running Windows.
4+
ms.date: 03/20/2025
5+
ms.author: dpless
6+
author: dplessMSFT
7+
ms.reviewer: mathoma, v-sidong
8+
ms.custom: sap:Installation, Patching, Upgrade, Uninstall
9+
---
10+
# SQL Server installation fails with sector size error on a Windows Server 2022 Azure virtual machine
11+
12+
This article helps you resolve a problem that occurs when you try to manually install a SQL Server instance on a Microsoft Azure virtual machine (VM) running Windows.
13+
14+
_Applies to:_   SQL Server, SQL Server on Azure VM - Windows
15+
16+
## Symptoms
17+
18+
When you try to install a SQL Server instance on an Azure virtual machine (VM) running Windows, the installation fails, and you receive the following error message in the SQL Server error log when the engine tries to start during the installation:
19+
20+
> Cannot use file '...\master.mdf' because it was originally formatted with sector size 4096 and is now on a volume with sector size 8192. Move the file to a volume with a sector size that is the same as or smaller than the original sector size.
21+
22+
Additionally, you can see the following information in the **Summary.txt** log file in the SQL Server setup folder:
23+
24+
```output
25+
Detailed results:
26+
Feature: Database Engine Services
27+
Status: Failed
28+
Reason for failure: An error occurred during the setup process of the feature.
29+
Next Step: Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
30+
Component name: SQL Server Database Engine Services Instance Features
31+
Component error code: 0x851A0019
32+
Error description: Could not find the Database Engine startup handle.
33+
```
34+
35+
This issue might occur with on-premises installations, but you're more likely to encounter it when installing SQL Server on Microsoft Azure virtual machine (VM).
36+
37+
## Cause
38+
39+
This issue occurs due to the sector size configuration of the disk on certain Azure virtual machines. Some of the latest Azure VM generations (such as Da, Ea, and Fav6) have an NVMe-only storage interface and require an OS image that supports NVMe. However, these latest Azure VM generations deploy with a default sector size of 8 KB, which isn't currently supported by SQL Server. SQL Server currently supports disks with standard native [sector sizes of 512 bytes and 4 KB](/sql/sql-server/install/hardware-and-software-requirements-for-installing-sql-server-2022#StorageTypes).
40+
41+
> [!NOTE]
42+
> Non-Volatile Memory Express (NVMe) is a communication protocol that facilitates faster and more efficient data transfer between servers and storage systems by using Non-Volatile Memory (NVM). With NVMe, data can be transferred at the highest throughput and with the fastest response times.
43+
44+
If an Azure virtual machine is deployed using the 8-KB sector size, and you attempt to install SQL Server after deployment, the installation might fail.
45+
46+
> [!NOTE]
47+
> This scenario only occurs when you manually install SQL Server on an Azure VM, but not when you deploy a SQL Server VM from Azure Marketplace. The Azure Marketplace images are preconfigured to use the 4-KB sector size.
48+
49+
## Resolution
50+
51+
To resolve this problem, reinstall SQL Server after forcing the Azure VM to use the 4-KB sector size.
52+
53+
To successfully install SQL Server on your Azure VM, follow these steps:
54+
55+
1. If you've already installed SQL Server, uninstall SQL Server. Otherwise, skip to the next step.
56+
1. Add the [ForcedPhysicalSectorSizeInBytes](../database-engine/database-file-operations/troubleshoot-os-4kb-disk-sector-size.md#resolutions) registry key.
57+
1. Verify the sector size is 4 KB by running the following command in an elevated command prompt:
58+
59+
`fsutil fsinfo sectorinfo <volume pathname>`
60+
61+
1. Restart the Azure VM.
62+
1. Reinstall SQL Server.
63+
64+
The following screenshot shows the output of the `fsutil fsinfo sectorinfo` command for the `E:` drive, which has a 8-KB sector size:
65+
66+
:::image type="content" source="media/sql-installation-fails-error-azure-vm/8k-sector-size-example.png" alt-text="Screenshot of command prompt output of 8-KB sector size.":::
67+
68+
The following screenshot shows the output of the `fsutil fsinfo sectorinfo` command for the `E:` drive after updating the registry key to use the 4-KB sector size:
69+
70+
:::image type="content" source="media/sql-installation-fails-error-azure-vm/4k-sector-size-example.png" alt-text="Screenshot of command prompt output of 4-KB sector size.":::
71+
72+
The `ForcedPhysicalSectorSizeInBytes` registry key is an OS-level setting, meaning that all drives currently attached, and those attached in the future, use the 4-KB sector size unless this registry key is removed.
42.4 KB
Loading
Loading
71.6 KB
Loading
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Performance Degradation from Misaligned I/O Sector Size Error
3+
description: This article describes how to resolve misaligned I/O operations due to sector size mismatches in SQL Server.
4+
ms.author: dpless
5+
author: dplessMSFT
6+
ms.reviewer: mathoma, v-sidong
7+
ms.date: 03/20/2025
8+
ms.custom: sap:Installation, Patching, Upgrade, Uninstall
9+
---
10+
# Performance degradation caused by misaligned I/O sector size errors in SQL Server
11+
12+
_Applies to:_ &nbsp; SQL Server
13+
14+
This article introduces how to resolve performance degradation due to misaligned I/O operations in SQL Server when the physical sector size differs between disk drives.
15+
16+
## Overview
17+
18+
SQL Server can encounter misaligned I/O operations when the physical sector size of disk drives differs between servers or storage systems. This condition can degrade performance and is particularly common in environments where sector size mismatches are evident, such as:
19+
20+
- Virtual machines with attached storage
21+
- Always On availability groups
22+
- Log shipping
23+
- Hardware migrations
24+
25+
For instance, a common issue occurs when the primary server uses a 4-KB sector size while the secondary server uses 512 bytes. This issue causes misaligned I/O operations during log synchronization or restore processes. This misalignment can result in performance degradation, such as slow restores or synchronization delays.
26+
27+
[Trace Flag 1800](/sql/t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql#tf1800) ensures that SQL Server uses a consistent 4-KB sector size for transaction log I/O operations, regardless of the underlying disk's physical sector size. This trace flag is designed to maintain performance in mixed environments where servers might have been upgraded or migrated to hardware with different storage specifications.
28+
29+
For databases with write-intensive workloads, aligning I/O operations can significantly improve performance, whereas the benefits might be negligible in read-intensive environments.
30+
31+
## Symptoms
32+
33+
You might experience performance degradation in SQL Server due to misaligned I/O operations if you encounter any of the following symptoms:
34+
35+
- **Slow synchronization or restore times**: Misaligned I/O operations can result in slow synchronization or restore times, especially in distributed SQL Server environments, such as Always On availability groups or log shipping.
36+
- **Error messages in the SQL Server error log**: Error messages related to I/O operations can indicate misalignment issues, such as:
37+
38+
`There have been # misaligned log IOs which required falling back to synchronous IO.`
39+
40+
- **Performance bottlenecks during write-intensive operations**: Write-intensive operations, such as log backups or database restores, might experience high disk latency and increased I/O wait times due to misaligned I/O operations, leading to performance bottlenecks and slow response times.
41+
42+
## Verify the sector size
43+
44+
To avoid misaligned I/O operations, it's important to ensure that the physical sector size of the disk drives is consistent across all servers and storage systems.
45+
46+
You can verify the [sector size](../../azure-sql/sql-installation-fails-sector-size-error-azure-vm.md) by running the following command in an elevated command prompt:
47+
48+
```cmd
49+
fsutil fsinfo sectorinfo <volume path name>
50+
```
51+
52+
The following screenshot shows the output of the `fsutil fsinfo sectorinfo` command for the `E:` drive, which has a sector size of 8 KB but a physical sector size of 4 KB, causing misaligned I/O operations:
53+
54+
:::image type="content" source="../../azure-sql/media/sql-installation-fails-error-azure-vm/8k-sector-size-example.png" alt-text="Screenshot of the command prompt output of the 8-KB sector size.":::
55+
56+
## Resolution
57+
58+
If you're experiencing performance degradation due to misaligned I/O operations and can't [modify your sector size](../database-file-operations/troubleshoot-os-4kb-disk-sector-size.md#resolutions), you can use [Trace Flag 1800](/sql/t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql#tf1800) as a global startup parameter to force SQL Server to use a consistent 4-KB sector size for transaction log I/O operations.
59+
60+
To enable Trace Flag 1800 as a startup parameter, follow these steps:
61+
62+
1. On the system where SQL Server is installed, open [SQL Server Configuration Manager](/sql/relational-databases/sql-server-configuration-manager).
63+
1. Expand **SQL Server Configuration Manager (Local**) and select **SQL Server Services**.
64+
1. Right-click the SQL Server instance you want to configure and select **Properties**:
65+
66+
:::image type="content" source="media/performance-degradation-misaligned-io-sector-error/sql-server-configuration-manager-properties.png" alt-text="Screenshot of the SQL Server service right-click menu with Properties highlighted.":::
67+
68+
1. In **SQL Server Properties**, select the **Startup Parameters** tab, enter `-T1800` in the **Specify a startup parameter** field, and select **Add** to add the parameter to the list.
69+
70+
:::image type="content" source="media/performance-degradation-misaligned-io-sector-error/add-1800-trace-flag.png" alt-text="Screenshot of adding the trace flag as a startup parameter in SQL Server Properties.":::
71+
72+
1. Confirm your trace flag has been added to the list of startup parameters. Select **OK** to save your changes:
73+
74+
:::image type="content" source="media/performance-degradation-misaligned-io-sector-error/trace-flag-1800.png" alt-text="Screenshot of the SQL Server properties window with startup parameters highlighted.":::
75+
76+
1. Restart the SQL Server service to enable the trace flag when your instance starts.
77+
78+
## References
79+
80+
[KB3009974 - FIX: Slow synchronization when disks have different sector sizes](https://support.microsoft.com/topic/kb3009974-fix-slow-synchronization-when-disks-have-different-sector-sizes-for-primary-and-secondary-replica-log-files-in-sql-server-ag-and-logshipping-environments-ed181bf3-ce80-b6d0-f268-34135711043c)

support/sql/database-engine/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ items:
154154
href: performance/understand-resolve-blocking.md
155155
- name: Upgrading compatibility level degrades performance for spatial queries
156156
href: performance/upgrade-compatibility-level-degrades-performance.md
157+
- name: Performance issue from misaligned I/O
158+
href: performance/performance-degradation-misaligned-io-sector-error.md
157159

158160
- name: Security, Encryption, Auditing, Authorization
159161
href: security/toc.yml

support/sql/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ items:
99

1010
- name: Azure SQL Virtual Machine
1111
items:
12+
- name: SQL Server installation fails on some Azure VMs
13+
href: azure-sql/sql-installation-fails-sector-size-error-azure-vm.md
1214
- name: FCI installation fails with error on Azure VM
1315
href: azure-sql/fci-installation-fails-error-azure-vm.md
1416

0 commit comments

Comments
 (0)