File Size Maintenance
File Size Maintenance — referred to internally as SizeProtect — proactively grows database files before they run out of space. Rather than relying on SQL Server's auto-grow mechanism, which fires reactively and can stall queries while a file expands, DB24 monitors free space within each database file on a schedule and pre-allocates space when headroom drops below a configured threshold.
Eligibility
A database file must meet all of the following conditions to be considered for growth.
| Condition | Rule |
|---|---|
| Access | The service account must have access (HAS_DBACCESS() = 1) |
| Read-only | Database must not be read-only |
| AG role | AG secondaries are excluded — file growth must run on the primary |
| System databases | tempdb is always excluded |
| Exclusions | Not listed in the exclusions table |
| Free space | File's current free space percentage must be below the configured threshold |
Both data files and log files are evaluated independently. Each file is assessed and grown on its own merits.
Configuration
| Parameter | Default | Description |
|---|---|---|
FileSpaceTresholdPercent |
20% | Minimum free space a file must maintain. Files below this trigger a growth operation |
| Growth buffer | 5% | Added on top of the threshold to determine the post-growth target. A file breaching the 20% threshold will be grown to reach 25% free |
The threshold is capped at 60% — DB24 will never attempt to maintain more than 60% free space in a file, regardless of configuration.
How Growth Is Calculated
When a file qualifies for growth, DB24 calculates the exact size needed to restore the file to the target free space level:
- Target free percent =
FileSpaceTresholdPercent+ 5% buffer (e.g. 20% + 5% = 25% free) - Target file size =
SpaceUsedMB÷(1 − TargetFreePercent) - Growth amount =
TargetFileSizeMB−CurrentFileSizeMB
The result is a single ALTER DATABASE ... MODIFY FILE command that sets the file to its new target size in one operation.
Safety Checks
Before any growth is applied, DB24 runs three safety checks against the host volume. If any check fails, the growth is cancelled and a warning is logged — the file is left at its current size.
MSP001 — Insufficient disk space
The volume does not have enough free space to accommodate the required growth. The operation is cancelled.
MSP002 — Post-growth disk free would fall below threshold
Even though there is technically enough space for the growth, doing so would leave the volume's free space percentage at or below the configured disk space threshold. The operation is cancelled to protect other databases on the same volume.
MSP003 — Growth would consume more than 80% of available disk free space
The required growth would use more than 80% of all currently available space on the volume. This guard prevents a single database file from monopolising the remaining headroom on a shared volume.
All three checks are evaluated in order. The first one that fails stops processing for that file, and the reason is recorded in the maintenance log with a structured note code (MSP001, MSP002, MSP003).
Runtime Behaviour
Maintenance window is enforced per file.
The window is checked at the start of every iteration. If the window closes mid-run, the current file is skipped and all remaining files are abandoned.
Disk space is checked per file, per volume.
Each file's host volume is inspected before growth is attempted. If the volume check itself returns invalid data (e.g. due to a WMI or collector failure), the file is skipped and a warning is logged.
Each volume breach is logged once per run.
If multiple files share a volume that has hit a disk threshold, only the first breach generates a warning entry — subsequent files on the same volume are silently skipped to avoid log noise.
Successful growths are fully logged.
Every completed growth operation is recorded in the maintenance log with before/after sizes, free space percentages, and volume impact — giving a clear audit trail of how files have grown over time.
