Help Center Ms-Sql-LocalDb Sector Size > 4KB
Ms-Sql-LocalDb Sector Size > 4KB
Fixing Microsoft SQL Server LocalDB when NVMe Sector Size is greater than 4 KB
Be aware that Microsoft SQL Server LocalDB can only run on drives with a physical sector size of 4096 bytes or less.You can either:
- Use a workstation or drive with a SATA SSD (4096 bytes per sector), which is fully compatible.
- Or apply the following workaround for NVMe SSDs that report a larger sector size (8 KB, 16 KB, or 32 KB).
- Open Command Prompt as Administrator.
-
Check the drive sector information by typing:
fsutil fsinfo sectorinfo C:
- If “Bytes per physical sector” is 4096, LocalDB will work normally. If the value is greater than 4096, continue with the next steps.
- Open the Registry Editor (
regedit
). -
Navigate to the following path:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device
-
Create a new Multi-String Value named:
ForcedPhysicalSectorSizeInBytes
-
Set its value to:
* 4095
(Important: There must be a space between the asterisk and the number.) -
Alternatively, you can use the command line instead:
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" /v "ForcedPhysicalSectorSizeInBytes" /t REG_MULTI_SZ /d "* 4095" /f
- Close all windows and restart the computer.
-
After restart, recreate the LocalDB instance:
sqllocaldb info
sqllocaldb start mssqllocaldb
If it fails, then run:
sqllocaldb delete mssqllocaldb
sqllocaldb create mssqllocaldb
sqllocaldb start mssqllocaldb
- LocalDB should now start successfully.
If possible, prefer using a SATA SSD with a 4096-byte sector size, as this configuration is fully supported by Microsoft SQL Server LocalDB.
For more details and the official Microsoft troubleshooting guide, visit:
https://learn.microsoft.com/de-de/troubleshoot/sql/database-engine/database-file-operations/troubleshoot-os-4kb-disk-sector-size
An official fix from Microsoft is currently under development and will be provided in a future update.