SQL Server error 3257 - Insufficient free space
Published 06 February 2015
You may encounter the following error when restoring a backup to a compressed database using a T-SQL script:
Msg 3257, Level 16, State 1, Line 1 There is insufficient free space on disk volume '<volume>' to create the database. The database requires <x> additional free bytes, while only <y> bytes are available.
This error occurs when the disk space available for your compressed database files is less than the space that would be required if the files were not compressed.
Resolving this error
To prevent this error add a parameter to the hyperbac.conf configuration file:
- Open the hyperbac.conf file in a text editor.
By default, hyperbac.conf is located in %ProgramFiles%\Red Gate\HyperBac\bin on 32-bit machines and%ProgramFiles(x86)%\Red Gate\HyperBac\bin on 64-bit machines.
Add the following line at the end of the file:
VirtualDiskSize=<size in GB>
where <size in GB> is the amount of space that would be necessary to restore the database without compressing the database files.
For example, if you are trying to create a compressed database for which the uncompressed database files would require 100 GB of disk space, add the line:
You can set the VirtualDiskSize parameter to whatever value is necessary to accommodate the uncompressed size of the database files, irrespective of how much physical disk space is actually available. This value will be reported to SQL Server for all disk volumes.
- Run the restore process again. Provided you have set the VirtualDiskSize parameter to a high enough value, the "insufficient free space" error will not be raised by SQL Server.
- Once you have successfully created your compressed database, edit the hyperbac.conf file to remove the VirtualDiskSizeparameter.
The VirtualDiskSize parameter affects all the restore operations you run on this SQL Server. If you leave theVirtualDiskSize parameter in place, this may cause problems with subsequent restore operations that are not using SQL Storage Compress, as the reported free space available on the disk volumes will be incorrect.
When you use the wizard to restore a backup to a compressed database, configuration changes are made automatically to prevent this error occuring.