Why This Error Happens
Error 5048 typically occurs when SQL Server 2025 attempts to add a data file to a FILESTREAM-enabled filegroup, but the target filegroup either lacks the required FILESTREAM attribute or the underlying file path already contains conflicting data. This is commonly triggered by a mismatch between the file type being added (regular vs. FILESTREAM) and the filegroup’s configuration, or by insufficient NTFS permissions on the FILESTREAM data container folder. In Windows Server 2025 environments, this can also surface due to the FILESTREAM feature not being enabled at the SQL Server instance level, even though the filegroup was created with FILESTREAM syntax.
Step-by-Step Resolution Guide
Step 1: Verify FILESTREAM is Enabled at the Instance Level
- Open SQL Server Configuration Manager on Windows Server 2025 / Windows 11.
- Navigate to SQL Server Services → right-click your instance → Properties → FILESTREAM tab.
- Ensure “Enable FILESTREAM for Transact-SQL access” is checked, and if remote clients need access, also check “Enable FILESTREAM for file I/O streaming access.”
- Restart the SQL Server service after applying changes.
Step 2: Confirm Filegroup Type Matches the File Being Added
- Run the following query to inspect filegroup properties:
SELECT name, type_desc, is_default FROM sys.filegroups;
- Ensure you are adding a
FILESTREAM_DATAfile type only to filegroups wheretype_desc = 'FILESTREAM_DATA_FILEGROUP'. - If mismatched, create a new filegroup correctly using:
ALTER DATABASE YourDB ADD FILEGROUP FS_FileGroup CONTAINS FILESTREAM;
Step 3: Check NTFS Permissions on the Data Container Path
- Navigate to the intended FILESTREAM directory (e.g.,
C:\SQLData\FileStreamContainer). - Right-click → Properties → Security tab.
- Confirm the SQL Server service account (e.g.,
NT Service\MSSQLSERVER) has Full Control. - Ensure the folder is empty before SQL Server attempts to initialize it as a new container; delete any residual files if a previous attempt failed.
Step 4: Retry Adding the File Using Correct Syntax
- Use the full ALTER DATABASE statement, matching path and filegroup name exactly:
ALTER DATABASE YourDB
ADD FILE (NAME = FS_Data, FILENAME = 'C:\SQLData\FileStreamContainer')
TO FILEGROUP FS_FileGroup;
- Confirm no trailing backslash or invalid characters exist in the FILENAME path, as Windows Server 2025 FILESTREAM paths are strict about folder naming.
Alternative or Verification Steps
- Verify the fix by querying
sys.database_filesto confirm the new file appears withtype_desc = 'FILESTREAM'andstate_desc = 'ONLINE'. - If the error persists, drop and recreate the filegroup from scratch in a test database first, ensuring the container directory does not pre-exist (SQL Server must create it fresh).