How to fix Error 5119 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 5119 occurs when SQL Server attempts to create a database file (typically for snapshots, FILESTREAM, or sparse file-dependent features) on a volume whose file system does not support the sparse file attribute. This commonly happens when the database files reside on a ReFS/FAT32 volume misconfigured for sparse operations, or when the NTFS volume has sparse file support disabled via policy or corruption. It can also occur if the SQL Server service account lacks the NTFS permissions required to set file attributes on the target directory.

Step-by-Step Resolution Guide

Step 1: Verify the File System Type

  • Open PowerShell as Administrator and run:
    Get-Volume -DriveLetter D | Select FileSystemType
  • Confirm the drive hosting your database files is formatted as NTFS. Sparse files are not supported on FAT32 or exFAT volumes.
  • If the volume is not NTFS, you must migrate the database files to an NTFS-formatted volume.

Step 2: Check and Enable Sparse File Support on NTFS

  • Run fsutil fsinfo ntfsinfo D: to confirm the volume is healthy and NTFS version is current.
  • Manually test sparse file creation using:
    fsutil sparse setflag C:\Temp\test.txt
  • If this command fails with an error, the volume may have corruption or be mounted with restrictive mount options; run chkdsk D: /f and reboot to repair the file system.

Step 3: Validate NTFS Permissions for the SQL Service Account

  • Navigate to the data directory (e.g., C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA).
  • Right-click the folder > Properties > Security tab, and ensure the SQL Server service account (e.g., NT Service\MSSQLSERVER) has Full Control.
  • Apply permissions recursively using:
    icacls "D:\SQLData" /grant "NT Service\MSSQLSERVER:(OI)(CI)F" /T

Step 4: Recreate the Snapshot or Database File

  • Drop any existing failed database snapshot using DROP DATABASE [SnapshotName];
  • Re-run the CREATE DATABASE ... AS SNAPSHOT OF command pointing to the verified NTFS path.
  • Monitor the SQL Server Error Log for successful file creation confirmation.

Alternative or Verification Steps

  • Run SELECT name, physical_name FROM sys.master_files; to confirm the new sparse file was created successfully in the target directory.
  • If the issue persists on a cluster or SAN-attached volume, check with your storage administrator to ensure the LUN is formatted/mounted correctly, as some third-party deduplication storage filters can block sparse file flags.