Rick Debay wrote:

gbak: ERROR: I/O error for file "/tmp/fb_sort__M9plMy"
gbak: ERROR:     Error while trying to write to file
gbak: ERROR:     No space left on device

We've started getting this error when restoring an 11GB database. How much space should we estimate for temp files?

Thomas Steinmaurer answers:

Twice the size is an old and possibly still a good guess, I think. It all depends on the number and size of the indices.

Ann W. Harrison answers:

How much? More.

Each table must be sorted for each index defined. The sort doesn't use the whole record, just the key, the record number, and a small amount of overhead. The sort is done for each index, and no sorts are done in parallel. If you have lots of small tables, you'll need less space than if you have a few very large tables. The amount of space used is determined by the index with the largest key in the largest table and may require considerably more space than the index it eventually creates if sub-sorts have to be merged to disk.

Rick Debay replied:

So to restore an 11GB database we should have 22GB available where TempDirectories points?

Alexey Kovyazin answers:


Download our free tool DBInfo and open your database there. Look at Index Pages size. If you have the single table with the single index in the database, it will be close to the size you need to have in Temp, otherwise it will be less (during restore indices are being built one by one).

Detailed breakdown for each index you can figure out by investigating:

gstat -r

statistics (or look at IBAnalyst to have it visualized).

Our FBDataGuard, among other things, calculate ## and size of temp files, raises alerts and store historical logs, in order to track and predict temp space usage.

Like this post? Share on: TwitterFacebookEmail

Related Articles


Firebird Community



Gems from Firebird Support list