8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00
firebird-mirror/doc/README.raw_devices

80 lines
2.3 KiB
Plaintext
Raw Normal View History

2007-11-26 09:55:45 +01:00
Issue:
2007-11-22 13:22:00 +01:00
======
2007-11-26 09:55:45 +01:00
When database in forced writes mode grows rapidly, filesystem
disk operations produce a serious overhead, making performance
2007-11-22 13:22:00 +01:00
up to 3 times lower compared with turned off forced writes.
Scope:
======
2007-11-26 09:55:45 +01:00
Mainly affects Linux, because Linux misses appropriate system
2007-11-22 13:22:00 +01:00
call to make database file grow efficiently.
Document author:
=================
Alex Peshkov (peshkoff@mail.ru)
Document date: 2007/11/21
==============
2007-11-24 01:12:17 +01:00
To make firebird have better performance under such circumstances
2007-11-26 09:55:45 +01:00
you may place your database not in a regular file on some
filesystem, but on raw device. Any type of block devices is
2007-11-22 13:22:00 +01:00
supported.
For example:
gbak -c my.fbk /dev/sda7
2007-11-26 09:55:45 +01:00
will restore your database on the third logical of extended
2007-11-22 13:22:00 +01:00
partition of your SCSI(SATA) disk0.
Known issue:
To be able to do physical (using nbackup utility) copy of
database you MUST specify explicit name of difference file:
2007-11-26 09:55:45 +01:00
2007-11-22 13:22:00 +01:00
# isql /dev/sda7
SQL> alter database add difference file '/tmp/dev_sda7';
2007-11-26 09:55:45 +01:00
2007-11-22 13:22:00 +01:00
This is required because default location of difference file
will be in /dev, which is surely not what you need. It's also
2007-11-26 09:55:45 +01:00
better to know how many blocks on block device are actually
occupied (or you will have to copy all data on raw device,
which can make size of your copy abnormally large). To obtain
2007-11-22 13:22:00 +01:00
real size of database, you should use '-S' switch of nbackup:
# nbackup -s -l /dev/sda7
77173
2007-11-26 09:55:45 +01:00
Where 77173 is a number of pages, occupied by database. Take
care - this is database's page size, not disk physical block
size! If unsure, use
2007-11-22 13:22:00 +01:00
# gstat -h /dev/sda7
Database "/dev/sda7"
Database header page information:
Flags 0
Checksum 12345
Generation 43
Page size 4096 <== that's what you need
ODS version 11.1
2007-11-26 09:55:45 +01:00
. . . . . . .
2007-11-22 13:22:00 +01:00
You may use nbackup output directly in a script, performing
database backup:
2007-11-26 09:55:45 +01:00
2007-11-22 13:22:00 +01:00
# DbFile=/dev/sda7
# DbSize=`nbackup -L $DbFile -S` || exit 1
2007-11-26 09:55:45 +01:00
# dd if=$DbFile ibs=4k count=$DbSize | # compress and record DVD
2007-11-22 13:22:00 +01:00
# nbackup -N $DbFile
Or perform physical backup using nbackup:
# nbackup -B 0 /dev/sda7 /tmp/lvl.0
2007-11-26 09:55:45 +01:00
In all other aspects raw devices do not have known specific
in use.
Tip: it's good idea to have raw devices in aliases.conf - in
2007-11-22 13:22:00 +01:00
case of HW reconfiguration of your server you will not need to
change connection strings.