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).
Workaround for NVMe SSDs:
  1. Open Command Prompt as Administrator.
  2. Check the drive sector information by typing:
    fsutil fsinfo sectorinfo C:
  3. If “Bytes per physical sector” is 4096, LocalDB will work normally. If the value is greater than 4096, continue with the next steps.
  4. Open the Registry Editor (regedit).
  5. Navigate to the following path:
    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device
  6. Create a new Multi-String Value named:
    ForcedPhysicalSectorSizeInBytes
  7. Set its value to:
    * 4095
    (Important: There must be a space between the asterisk and the number.)
  8. 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
  9. Close all windows and restart the computer.
  10. 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
  11. 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.