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

Why This Error Happens

Error 561 occurs when the SQL Server database engine service account lacks the necessary NTFS permissions to read, write, or open a specific database file (.mdf, .ndf, or .ldf) at the operating system level. This can also happen if the file has been moved, renamed, deleted, or is currently locked by another process, antivirus scanner, or backup utility. In some cases, the underlying storage volume itself may be offline, disconnected, or experiencing disk-level corruption preventing the file handle from being opened.

Step-by-Step Resolution Guide

Step 1: Verify the File Path and Existence

  • Open File Explorer or PowerShell and navigate to the exact path referenced in the error message (e.g., D:\SQLData\YourDB.mdf).
  • Confirm the file has not been renamed, moved, or deleted accidentally.
  • Run Get-ChildItem "D:\SQLData\" -Force in PowerShell to check for hidden or system-flagged files.

Step 2: Correct NTFS Permissions for the SQL Service Account

  • Right-click the database folder (e.g., D:\SQLData) → Properties → Security tab.
  • Ensure the SQL Server service account (e.g., NT Service\MSSQLSERVER or a custom domain account) has Full Control permissions.
  • Apply permissions recursively using: icacls "D:\SQLData" /grant "NT SERVICE\MSSQLSERVER":(OI)(CI)F /T
  • Restart the SQL Server service via services.msc after applying changes.

Step 3: Check for File Locks or Conflicting Processes

  • Use Resource Monitor (resmon.exe) → CPU tab → Associated Handles to search for the locked .mdf or .ldf file.
  • Temporarily disable real-time antivirus scanning on the SQL data directory to rule out interference.
  • Ensure no third-party backup tool is holding an open handle to the file during the SQL Server startup sequence.

Step 4: Validate Disk and Volume Health

  • Run chkdsk D: /f /r (schedule on reboot if the volume is in use) to check for underlying disk corruption.
  • Confirm the storage volume is online via Disk Management (diskmgmt.msc), especially if using SAN, iSCSI, or Storage Spaces Direct on Windows Server 2025.
  • If using Azure-attached disks or cloud storage, verify connectivity and mount status.

Step 5: Restart SQL Server and Monitor the Error Log

  • Restart the SQL Server (MSSQLSERVER) service through SQL Server Configuration Manager.
  • Open the SQL Server Error Log (via SSMS → Management → SQL Server Logs) to confirm Error 561 no longer appears on startup.

Alternative or Verification Steps

  • Run RESTORE VERIFYONLY FROM DISK = 'PathToBackup' or attempt sp_attach_db manually in SSMS to confirm the file is now accessible without errors.
  • If permissions and locks are not the cause, restore the affected database file from the most recent verified backup to a healthy volume and reattach it via CREATE DATABASE ... FOR ATTACH.