Skip to content

fix: install SQL Server on another volume when C: has large sectors - #349

Merged
dhensby merged 2 commits into
tediousjs:masterfrom
dhensby:fix/large-sector-instance-dir
Nov 21, 2026
Merged

dhensby merged 2 commits into
tediousjs:masterfrom
dhensby:fix/large-sector-instance-dir

Conversation

@dhensby

@dhensby dhensby commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

SQL Server can't start from a volume whose physical sector size is over 4 KB. The C: drive of some GitHub-hosted windows-2022 runners reports 8 KB, so setup fails there with 0x851A0019 or 0x851A001A. This caused every intermittent runaction failure since October. A failure on a push to master also skips the release for that push.

This PR makes the action install the instance on the runner's temporary volume (D: on GitHub-hosted runners) when the default volume has large sectors.

What changes

  • Before setup, the action reads the sector size of the Program Files volume with fsutil fsinfo sectorinfo. It uses the larger of PhysicalBytesPerSectorForAtomicity and PhysicalBytesPerSectorForPerformance, as Microsoft's troubleshooting page says.
  • If that size is over 4096 bytes, and the volume of RUNNER_TEMP reports 4096 or less, the action adds /INSTANCEDIR="D:\Microsoft SQL Server" and /INSTALLSQLDATADIR="D:\Microsoft SQL Server" and logs a warning. Both switches are needed: the data directory holds the system databases, and the instance directory holds the resource database.
  • If install-arguments sets /INSTANCEDIR or /INSTALLSQLDATADIR, the action keeps the user's directories.
  • If there's no suitable volume, or the sector size can't be read, the action runs setup with the default directories, as it does now. When C: is over 4 KB, it also logs a warning that links to Microsoft's registry fix.
  • The README has a new "Disks with large sectors" section.

Runners whose C: reports 4 KB or less see no change.

Microsoft's own fix is the ForcedPhysicalSectorSizeInBytes registry value, but it needs a reboot, so a job can't use it. Trace flag 1800 doesn't help, and setup has no switch for sector size.

Evidence

  • From 13 October to 20 November, 1,440 runaction jobs logged their hardware. All 14 jobs whose C: reported 8192 failed, on SQL Server 2016, 2017, 2019 and 2025. None of the 1,426 jobs at 4096 failed. All 14 were on windows-2022 (13 Standard_D4ds_v7, 1 Standard_D4ads_v6).
  • On my fork, I ran two test workflows with the switches in install-arguments (run 1, run 2). On runners whose C: reported 8192:
    • Both switches: 13 of 13 installs passed, covering 2016, 2017, 2019, 2022 and 2025. Every database file and backup was on D:, the engine restarted cleanly, and the error log had no sector messages.
    • /INSTALLSQLDATADIR alone: 0 of 4 passed. The resource database (Binn\mssqlsystemresource.ldf) stayed on C: and failed with misaligned log IOs.
    • On normal runners, both switches installed cleanly on 20 of 20 jobs (windows-2022 and windows-2025).
  • With the code in this PR and no install-arguments (run 3), 6 of 6 runners whose C: reported 8192 installed in D:\Microsoft SQL Server and passed the same checks (2016, 2017 and 2025). Each of those jobs logged the warning once. 10 of 10 normal runners kept the default directories and logged no warning.
  • The CI run on my fork passed, including the new custom-dirs variant. No job in that run got an affected runner.

CI

  • A new custom-dirs variant sets both switches through install-arguments, and checks that the instance reports its data path there. This tests the switches and the opt-out on every push, not only when a job gets an affected runner.
  • Every runaction job now prints its data path. When a job fails, CI also uploads the error logs from the D: directories.

Checks

  • npm run lint, npm run typecheck and npm test (255 tests) pass. npm run build leaves no changes.
  • I checked that the new tests fail when the code they cover breaks: a 8192-byte limit, reading only the atomicity value, ignoring the user's switches, dropping either switch, allowing the temporary directory on the default volume, ignoring ProgramFiles, and dropping the arguments from the setup command.

🤖 Generated with Claude Code

dhensby and others added 2 commits November 21, 2026 09:12
SQL Server can't start from a volume whose physical sector size is
over 4 KB, and the C: drive of some GitHub-hosted windows-2022 runners
reports 8 KB. On those runners, setup failed with 0x851A0019 or
0x851A001A.

Before setup, read the sector size of the Program Files volume with
fsutil. If it is over 4 KB, and the volume of the runner's temporary
directory reports 4 KB or less, pass /INSTANCEDIR and
/INSTALLSQLDATADIR for that volume and log a warning. Both switches
are needed, because the instance directory holds the resource
database. If install-arguments sets either switch, keep the user's
directories.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a runaction variant that sets /INSTANCEDIR and /INSTALLSQLDATADIR
through install-arguments, and check that the instance reports a data
path in that directory. This runs the setup switches that the action
uses on runners with large sectors on every push, and checks that the
user's directories win.

Print the data path in every job. When a job fails, also upload the
error logs from the instance directories on the D: drive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhensby
dhensby marked this pull request as ready for review November 21, 2026 09:57
@dhensby
dhensby merged commit c373dff into tediousjs:master Nov 21, 2026
22 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant