Ben Short wrote:

I am using Linux Firebird 2.1.3 Classic Server (as Embedded) on a raw device.

I have been using the `isc_database_info` interface to query the database info.

The values I'm particularly interested in are `isc_info_allocation` and `isc_info_db_size_in_pages` but they always return 0.

Can anyone help me out with this?

Mariuz answers:

I don't think is implemented yet so this is why it returns 0 This is one of the drawbacks of firebird on raw devices, see next excerpt from Milan Babuškov' session:

In Firebird 2.1, a new alternative is introduced. You can skip the filesystem completely and write the data directly to the disk partition. This approach has advantages and disadvantages.


  • no filesystem overhead, Firebird lays out data in pages anyway
  • no chance that someone would accidentally delete or rename the file
  • no problems with mounting and un-mounting because it is never mounted


  • fixed size. This can turn into problem when database grows big
  • you have to decide the size up-front, meaning less space for rest of the system
  • no system control when it's about to be full. You have to check in manually with Firebird tools.
  • it's not very easy to move the file to another server. Once again, you need to check with Firebird tools and then use some tool like 'dd' to copy only the used pages.
  • If you have a corrupt database and want to make a copy, you need to copy the entire partition, since you cannot check the size (assuming it is corrupt in such way).
  • you don't have filesystem, so no filesystem cache – use Firebird cache

How to use it:

  • backup the existing database and restore to a raw device
  • create a new database on raw device

# isql
> create database '/dev/sda1';
> exit;

Just like you would do with a regular database file. Firebird detects that /dev/sda1 is not a regular file, but a block device and does not try to replace the file, but rather writes to the row storage. On Linux, all

files and devices are represented (accessible) via inodes. For raw devices, inode contains the information about hardware 'location' of the raw device. For example:

$ ls -l /dev/sda1
brw-r----- 1 root disk 8, 1 2008-09-25 19:32 /dev/sda1

you can see that /dev/sda1 is the first partition on device 8 (which is a SATA hard disk in this machine). It is read-only to the users in 'disk' group, and 'root' user has read-write privilege. The letter 'b' denotes that it is not a regular file, but a block device. If you want, you don't have to use the paths in /dev, but create the inode with same information anywhere in the filesystem using the 'mknod' command:

root@slicky:~# mknod my_db b 8 1
root@slicky:~# ls -l
brw-r--r-- 1 root root 8, 1 2008-09-25 18:08 my_db

This is also useful if you restrict directories in firebird.conf, you don't really want to allow /dev to be used. It is also useful when you change hardware, and it is not the same path in /dev. However, this second issue can also be fixed by setting the appropriate database alias.

Link to full paper: Firebird on Linux - advanced topics

Like this post? Share on: TwitterFacebookEmail

Related Articles


Firebird Community



Gems from Firebird Support list