SQL Server Doesn't Start on Windows 11

Description

eWay-CRM log contains similar error:

System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Error occurred during LocalDB instance startup: SQL Server process failed to start.)

LocalDB Event Log shows:

Faulting application name: sqlservr.exe, version: 2019.150.2000.5, time stamp: 0x5d8a9215
Faulting module name: ntdll.dll, version: 10.0.22621.1485, time stamp: 0xb7f0154a
Exception code: 0xc0000005
Fault offset: 0x000000000001e1f9
Faulting process ID: 0x0x1C98
Faulting application start time: 0x0x1D96ECC1232CD5F
Faulting application path: C:\Program Files\Microsoft SQL Server\150\LocalDB\Binn\sqlservr.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report ID: 6a1370ec-27fa-4ea1-b041-3df9179c7bc1
Faulting package full name:
Faulting package-relative application ID:

Event Viewer error:

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. 

The issue is that on Windows 11 and higher, you can use sectors bigger than 4 kB but there is no SQL Server that supports it: https://docs.microsoft.com/en-us/troubleshoot/sql/admin/troubleshoot-os-4kb-disk-sector-size

Version

All versions of eWay-CRM

Difficulty

High

Resolution

  1. Check that there is some value from BytesPerSector higher than 4096:
C:\>fsutil fsinfo sectorInfo C:
  1. Add the key (run cmd as administrator and call this command):
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" /v "ForcedPhysicalSectorSizeInBytes" /t REG_MULTI_SZ /d "* 4095" /f
  1. Check that the key was added:
REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" /v "ForcedPhysicalSectorSizeInBytes"
  1. Restart PC.
  2. Check that the value was applied:
C:\>fsutil fsinfo sectorInfo C:
  1. Check that LocalDB start, otherwise re-create it.