Troubleshoot errors related to system disk sector size greater than 4 KB

This article provides solutions for troubleshooting errors during installation or starting SQL Server on Windows 11 related to system disk sector size greater than 4 KB.

Symptoms

Scenario #1: You install SQL Server 2019, SQL Server 2017, or SQL Server 2016 on a Windows 11 device and you see errors similar to the following for the Database Engine Services component of SQL Server:

Feature: Database Engine Services 
Status: Failed 
Reason for failure: An error occurred during the setup process of the feature. 
Next Step: Use the following information to resolve the error, uninstall this feature, and then run the setup process again. 
Component name: SQL Server Database Engine Services Instance Features 
Component error code: 0x851A001A 
Error description: Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes. 

Scenario #2: You install SQL Server 2019, SQL Server 2017, or SQL Server 2016 on a Windows 10 device. Then you upgrade the OS on the device to Windows 11. When you try to start SQL Server 2019, SQL Server 2017, or SQL Server 2016 on a Windows 11 device, the service fails to start and in the SQL Server error log, you notice entries similar to:

2021-11-05 23:42:47.14 spid9s There have been 256 misaligned log IOs which required falling back to synchronous IO. The current IO is on file C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\master.mdf. 

Scenario #3: You install SQL Server 2019, SQL Server 2017, or SQL Server 2016 on a Windows 10 device. Then you upgrade the OS on the device to Windows 11. When you try to start SQL Server 2019, SQL Server 2017, or SQL Server 2016 on a Windows 11 device, the service fails to start. In the SQL Server error log, you notice entries similar to:

Faulting application name: sqlservr.exe, version: 2019.150.2000.5, time stamp: 0x5d8a9215 
Faulting module name: ntdll.dll, version: 10.0.22000.120, time stamp: 0x50702a8c 
Exception code: 0xc0000005 
Fault offset: 0x00000000000357ae 
Faulting process id: 0x1124 
Faulting application start time: 0x01d7bf67449d262c 
Faulting application path: C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Binn\sqlservr.exe 
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll 

Scenario #4: You install LocalDB on a Windows 11 device. The setup fails and in the SQL Server error log, you notice entries similar to:

2021-12-15 23:25:04.28 spid5s      Cannot use file 'C:\Users\Administrator\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\TestInstance\master.mdf' because it was originally formatted with sector size 4096 and is now on a volume with sector size 16384. Move the file to a volume with a sector size that is the same as or smaller than the original sector size.

In the Windows 11 Application Event Log, you notice entries similar to:

Message            : Windows API call WaitForMultipleObjects returned error code: 575. Windows system error message is: {Application Error}
                     The application was unable to start correctly (0x%lx). Click OK to close the application.
                     Reported at line: 3621.
Source             : SQLLocalDB 11.0

Note

You might encounter the failures mentioned in the previous scenarios for a SQL Server instance you install manually or on a LocalDB instance installed by applications.

Cause

During service startup, SQL Server begins the database recovery process to ensure database consistency. Part of this database recovery process involves consistency checks on the underlying filesystem before attempting the activity of opening system and user database files.

On systems running Windows 11, some new storage devices and device drivers will expose a disk sector size greater than the supported 4 KB sector size.

When this occurs, SQL Server will be unable to start due to the unsupported file system as SQL Server currently supports sector storage sizes of 512 bytes and 4 KB.

You can confirm that you encounter this specific issue by running the command:

fsutil fsinfo sectorinfo <volume pathname>

For example, to analyze the E: volume, run the following command:

fsutil fsinfo sectorinfo E:

Look for the value PhysicalBytesPerSectorForAtomicity, returned in bytes. A value of 4096 indicates a sector storage size of 4 KB.

Additionally, be aware of the Windows support policy for file system and storage sector size support. For more information, see the Microsoft support policy for 4 KB sector hard drives in Windows article.

Note

There is no released version of SQL Server compatible with sector sizes greater than 4 KB. For more information, see the Hard disk drive sector-size support boundaries in SQL Server article.

Resolutions

Microsoft is currently investigating this problem.

Consider one of the following solutions:

  • If you have multiple drives on this system, you can specify a different location for the database files after installation of SQL Server is complete. Make sure that drive reflects a supported sector size when querying the fsutil commands. SQL Server currently supports sector storage sizes of 512 bytes and 4096 bytes.

  • You can add a registry key which will cause the behavior of Windows 11 and later to be similar to Windows 10. This will force the sector size to be emulated as 4 KB in size. To add the ForcedPhysicalSectorSizeInBytes registry key, use the Registry Editor, or you can run one of the following commands in Windows command prompt or PowerShell, executed as an administrator.

    Important

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

    Registry Editor

    1. Navigate to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device.
    2. On the Edit menu, point to New, and then select Multi-String value. Name it ForcedPhysicalSectorSizeInBytes.
    3. Modify the new value, type in * 4095. Click OK and close the Registry editor.

    Command Prompt as Administrator

    1. Add the key.
    REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" /v "ForcedPhysicalSectorSizeInBytes" /t   REG_MULTI_SZ /d "* 4095" /f
    
    1. Validate if the key was added successfully.
    REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" /v "ForcedPhysicalSectorSizeInBytes"
    

    PowerShell as Administrator

    1. Add the key.
    New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" -Name   "ForcedPhysicalSectorSizeInBytes" -PropertyType MultiString -Force -Value "* 4095"
    
    1. Validate if the key was added successfully.
    Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" -Name   "ForcedPhysicalSectorSizeInBytes"
    
  • You can start SQL Server by specifying the trace flag 1800. For more information, see DBCC TRACEON. This trace flag is not enabled by default. Trace flag 1800 forces SQL Server to use 4 KB as the sector size for all read and writes. When you are running SQL Server on disks with physical sector size greater than 4 KB, using the trace flag 1800 will simulate a native 4 KB drive, which is the supported sector size for SQL Server.

  • Install SQL Server on available Windows 10 devices instead.

More information

Windows 11 native NVMe drivers were updated to include the actual sector size reported directly by the NVMe storage devices, rather than relying on the information that is emulated from the filesystem drivers.

The Windows 10 drivers do not report the source sector size of the physical storage.

The improved Windows 11 drivers disregard the emulation that common NVMe storage devices are using. As an example, fsutil displays a sector size of 8 KB or 16 KB, rather than emulating the required 4 KB sector size needed by Windows.

The following table provides a comparison of the sector sizes reported by the operating systems. This example illustrates the differences between Windows 10 and Windows 11 using the same storage device. For the value of PhysicalBytesPerSectorForAtomicity, Windows 10 displays 4 KB and Windows 11 displays 16 KB.

Sample output of fsutil fsinfo sectorinfo <volume pathname>

Windows 10 Windows 11
LogicalBytesPerSector : 512 LogicalBytesPerSector : 512
PhysicalBytesPerSectorForAtomicity : 4096 PhysicalBytesPerSectorForAtomicity : 16384
PhysicalBytesPerSectorForPerformance : 4096 PhysicalBytesPerSectorForPerformance : 16384
FileSystemEffectivePhysicalBytesPerSectorForAtomicity : 4096 FileSystemEffectivePhysicalBytesPerSectorForAtomicity : 4096
Device Alignment : Aligned (0x000) Device Alignment : Aligned (0x000)
Partition alignment on device : Aligned (0x000) Partition alignment on device : Aligned (0x000)
No Seek Penalty No Seek Penalty
Trim Supported Trim Supported
Not DAX capable Not DAX capable
Not Thinly-Provisioned Not Thinly-Provisioned

See also