SQL Server does not start after installing LoMag on Windows 11 – quick diagnosis and fix

This guide is intended for Windows 11 users whose database does not start after installing LoMag (or SQL Server), who receive a message that SQL Server has stopped, or who encounter a database connection error. Below we describe the most common causes and the shortest repair paths.

Important: some steps require administrator privileges. If you do not have an administrator account, please ask your IT department or the person managing the computer to perform the steps marked “Run as administrator”.

SQL Server does not start in LoMag – symptoms

The most common messages are one of the following:

1. The program asks: “SQL Server has been stopped. Start it?”. Usually, clicking “Yes” does not solve the problem – the root cause must be removed.

Message: SQL Server has been stopped. Start it?

2. A database connection error message appears, for example: “Failed to start SQL Server... Cannot create the MSSQL$SQLEXPRESS service...”. This error often occurs on new NVMe drives with 4K physical sectors or when the drive or folder is compressed or encrypted.

Database connection error: Failed to start SQL Server

1. Cause #1: NVMe drive + 4K Physical Sector (Windows 11 / stornvme driver)

This is the most common case on new computers and laptops: the NVMe drive reports a physical sector size of 4096 bytes (4K), and because of this some installers and database services (including SQL Server) may fail to start properly.

1.1. Checking the drive type and Physical Sector Size

To verify this case, click Start (Windows logo) and type: powershell, then run PowerShell with the Run as administrator option.

In the PowerShell window, paste the following command: Get-PhysicalDisk | Select FriendlyName, BusType, LogicalSectorSize, PhysicalSectorSize and press Enter.

If BusType displays NVME and PhysicalSectorSize is 4096, this means the issue is caused by the NVMe drive configuration (4K Physical Sector).

1.2. Fixing NVMe + 4K Physical Sector

To resolve the SQL Server startup problem, a one-time change must be made in the Windows registry. To do this, type cmd in the Start search bar and run Command Prompt as Run as administrator.

In the CMD window, paste the following command: REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" /v "ForcedPhysicalSectorSizeInBytes" /t REG_MULTI_SZ /d "* 4095" /f and press Enter.

If the command runs successfully, a message similar to “The operation completed successfully.” will appear. After completing this step, you must restart the computer.

1.3. After restart – uninstall and reinstall SQL Server

After applying the registry fix, SQL Server must be reinstalled (otherwise the service may still fail to start).

To do this, go to SettingsAppsInstalled apps, then uninstall SQL Server (menu “...” → “Uninstall”). Reinstalling SQL Server is described here: SQL Server installation guide.

If the error still appears after reinstallation, please proceed to points 2–4, because the cause may be compression/encryption or the computer name.

2. Cause #2: Compressed drive or folder (NTFS Compression)

If the drive (e.g. C:) or the folder containing the database / SQL Server is compressed, SQL Server may not start properly. This applies to NTFS compression (the “Compress...” option).

2.1. Quick test – compact command

Run PowerShell as administrator or CMD as administrator, then enter: compact C:\ and press Enter.

If the result indicates that files are compressed, decompression must be performed (below).

2.2. Fix – disable compression

Option A – decompress the entire C: drive: (simplest, but may take some time)

compact /u /s /i C:\

Option B – decompress only the SQL Server folder: (faster)

compact /u /s /i "C:\Program Files\Microsoft SQL Server"

After decompression, perform a restart and launch LoMag again. If the problem still occurs, proceed to point 3.

3. Encrypted drive or folder (EFS) – “Encrypt contents to secure data”

If the folder containing the SQL Server / LoMag installation is encrypted (EFS), SQL Server may not start properly or may not be able to access the database files. Below is the quickest way to check this option in Windows 11.

To check encryption settings, go to the SQL Server/LoMag installation location. Most often this is the Program Files folder on drive C:.

Then go to the folder where SQL Server is installed (most commonly): C:\Program Files\Microsoft SQL Server\. Right-click the Microsoft SQL Server folder and select Properties.

In the “General” tab, click Advanced.... If the checkbox “Encrypt contents to secure data” is selected, clear it. Confirm the changes with OK and choose to apply changes to: this folder, subfolders, and files.

After the operation is completed, restart the computer and start LoMag again.

Note: in some Windows configurations, the “Encrypt contents...” option may not be visible in the properties of drive C:. In that case, the setting should be checked directly on the SQL Server installation folder (as described above).

4. Cause #4: The computer name has more than 15 characters or contains Polish characters

In some configurations, SQL Server Express may have problems with the computer/instance name if it is very long (more than 15 characters) or contains national characters (e.g. ą, ę, ł, ó, ś, ż, ź) or spaces.

4.1. How to check the computer name

Go to the Start menu and type System Information, run it, then find the Device name field.

If the name has more than 15 characters or contains Polish characters/spaces, it should be changed to a short and simple one (for example MAGAZYN01) according to the instructions below.

4.2. Renaming the computer (Windows 11)

To change the device name, go to: SettingsSystem, then select Rename.

Then enter a new name (max. 15 characters, no Polish characters, no spaces) and confirm. After changing the name, you must restart the computer and then reinstall SQL Server (as in point 1.3).

5. If the problem still occurs – what information to send to technical support

If SQL Server still does not start after completing steps 1–4, please send the information below. This will allow us to diagnose the cause faster and indicate the correct solution.

Based on the above data, we will prepare further steps or an instruction tailored to the given computer configuration.