SQL Server Error 1134 occurs when you attempt to restore a database onto a disk drive or partition that has less available space than the original data files required at the time of the backup. To fix this, you must either increase the available disk space on the destination drive or move the restore location to a larger volume using the RELOCATE option in T-SQL or the "Relocate all files to folder" option in SQL Server Management Studio (SSMS). This error is a physical storage limitation and cannot be bypassed by changing SQL Server settings; the physical bytes must have a place to land on the disk.

What You'll Need

  • Administrative access to the SQL Server instance.
  • SQL Server Management Studio (SSMS) or access to a Query window for T-SQL.
  • The .bak backup file you are attempting to restore.
  • Knowledge of the destination drive's current free space and the size of the backup's internal data files.
  • Permissions to create folders or move files on the target server's file system.

Step-by-Step

Depending on your preference, you can resolve this via the graphical interface or using a script. Note that menu labels may vary slightly depending on the version of SSMS you are using.

Method 1: Using SQL Server Management Studio (GUI)

  1. Open SQL Server Management Studio and connect to your instance.
  2. Right-click on the Databases folder in the Object Explorer and select Restore Database....
  3. In the Source section, select Device, click the ellipsis button (...), and add the .bak file from your storage.
  4. Once the backup set is loaded, look at the Files page in the left-hand pane of the Restore window.
  5. Check the Restore As column. This shows where SQL Server intends to place the .mdf (primary data) and .ldf (log) files. If these paths point to a drive that is nearly full, this is the cause of Error 1134.
  6. Check the box Relocate all files to folder. This allows you to specify a new directory on a different drive that has sufficient free space.
  7. Click the ellipsis button next to the path to browse and select a folder on a larger disk volume.
  8. Navigate to the Options page and ensure Overwrite the existing database (WITH REPLACE) is checked if you are replacing an old version of the database.
  9. Click OK to begin the restore process.

Method 2: Using T-SQL (The MOVE Command)

If the GUI is unresponsive or you prefer scripting, use the MOVE command to redirect the files to a larger drive during the restore process.

  1. Open a new Query window in SSMS.
  2. First, identify the logical names of the files inside the backup. Run the following command (replace the path with your actual backup path):
    RESTORE FILELISTONLY FROM DISK = 'C:\Backups\YourDatabase.bak';
  3. Note the LogicalName for both the data file and the log file from the results grid. You will need these for the next step.
  4. Construct a RESTORE DATABASE command using the MOVE clause. Use the following template, replacing the placeholders with your specific names and paths:
    RESTORE DATABASE YourDatabaseName FROM DISK = 'C:\Backups\YourDatabase.bak' WITH MOVE 'Logical_Data_Name' TO 'D:\SQLData\YourDatabase.mdf', MOVE 'Logical_Log_Name' TO 'D:\SQLLogs\YourDatabase_log.ldf', REPLACE;
  5. Ensure that the destination drive (in this example, the D: drive) has more free space than the size of the files listed in the FILELISTONLY output.
  6. Execute the query.

Common Mistakes

One of the most frequent mistakes is confusing the size of the .bak file with the size of the database. A backup file is often compressed, meaning a 100GB database might only result in a 20GB .bak file. If you only check for 20GB of free space on your destination drive, the restore will fail with Error 1134 because SQL Server needs to expand that backup into its full 100GB footprint on the disk.

Another common error is attempting to restore to a folder where the SQL Server Service Account does not have write permissions. Even if the drive has enough space, a permissions error can sometimes be misread or compounded by storage issues. Always ensure the account running the SQL Server service (e.g., NT Service\MSSQLSERVER) has full control over the target folder.

Users also frequently forget to move the log file (.ldf). While the data file is usually the largest, a bloated transaction log can also trigger Error 1134. Both the data and log files must fit on their respective destination drives.

Tips

To avoid this error in the future, implement a disk space monitoring alert on your SQL Server volumes. When a drive drops below 20% capacity, you should be notified so you can expand the volume or move older databases to archival storage before a critical restore is needed.

If you are restoring a database from a different environment (e.g., Production to Dev), always use the MOVE command. Production databases are typically much larger than Dev environments can handle, and they often use different drive lettering (e.g., Production uses E: and F: while Dev only has C:). Explicitly mapping the files ensures the restore doesn't try to write to a non-existent drive letter.

When using T-SQL, always run RESTORE FILELISTONLY first. Many users guess the logical names of the files, but if the logical name doesn't match exactly what is inside the backup header, the MOVE command will fail, leading to further frustration.

Troubleshooting

If you have moved the files to a larger drive and still receive Error 1134, check for the following:

  • Instant File Initialization: Ensure that the account running SQL Server has the "Perform Volume Maintenance Tasks" privilege in Windows Local Security Policy. This allows SQL Server to skip zeroing out the data files, which can occasionally resolve timeout-related storage errors that mimic size errors.
  • Disk Quotas: Check if Windows Disk Quotas are enabled on the destination drive. Even if the drive has 1TB free, if the SQL Server service account is restricted by a quota of 10GB, the restore will fail as if the disk is full.
  • Sparse Files: If you are restoring to a virtual machine, check if the virtual disk is "thin provisioned." The guest OS might think there is space, but the physical host storage might be exhausted, causing the write operation to fail.
  • Hidden Files/System Volume Information: Sometimes a drive appears to have space, but large hidden snapshots or system restore points are claiming the contiguous blocks needed for the database files. Run a disk cleanup or check the volume shadow copy settings.

Frequently Asked Questions

Can I shrink the database inside the backup file to make it fit?

No. A backup is a point-in-time snapshot of the data. You cannot shrink the files within the .bak file. You must restore it to a location with enough space, shrink the database once it is online, and then move the files if necessary.

Does the log file size contribute to Error 1134?

Yes. SQL Server requires enough space for both the primary data file (.mdf) and the transaction log file (.ldf). If either file exceeds the available space on its target drive, the error will occur.

Will increasing the RAM help with this error?

No. Error 1134 is strictly a disk storage issue. Adding more RAM will not provide the physical disk sectors required to store the database files.

Can I restore only a portion of the database to save space?

You cannot restore "part" of a single data file. However, if the database consists of multiple filegroups, you can perform a piecemeal restore of specific filegroups, provided the database was designed for it.

Why does the restore fail even though the .bak file is small?

Backup files are compressed. The .bak file is the "zipped" version; the restore process "unzips" it into the full size of the original database. You must account for the uncompressed size of the database, not the size of the backup file.