README.raw_devices 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Issue:
  2. ======
  3. When database in forced writes mode grows rapidly, filesystem
  4. disk operations produce a serious overhead, making performance
  5. up to 3 times lower compared with turned off forced writes.
  6. Scope:
  7. ======
  8. Mainly affects Linux, because Linux misses appropriate system
  9. call to make database file grow efficiently.
  10. Document author:
  11. =================
  12. Alex Peshkov ([email protected])
  13. Document date: 2007/11/21
  14. ==============
  15. To make firebird have better performance under such circumstances
  16. you may place your database not in a regular file on some
  17. filesystem, but on raw device. Any type of block device is
  18. supported.
  19. For example:
  20. gbak -c my.fbk /dev/sda7
  21. will restore your database on the third logical of extended
  22. partition of your SCSI(SATA) disk0.
  23. Known issue:
  24. To be able to do physical (using nbackup utility) copy of
  25. database you MUST specify explicit name of difference file:
  26. # isql /dev/sda7
  27. SQL> alter database add difference file '/tmp/dev_sda7';
  28. This is required because default location of difference file
  29. will be in /dev, which is surely not what you need. It's also
  30. better to know how many blocks on block device are actually
  31. occupied (or you will have to copy all data on raw device,
  32. which can make size of your copy abnormally large). To obtain
  33. real size of database, you should use '-S' switch of nbackup:
  34. # nbackup -s -l /dev/sda7
  35. 77173
  36. Where 77173 is a number of pages, occupied by database. Take
  37. care - this is database's page size, not disk physical block
  38. size! If unsure, use
  39. # gstat -h /dev/sda7
  40. Database "/dev/sda7"
  41. Database header page information:
  42. Flags 0
  43. Checksum 12345
  44. Generation 43
  45. Page size 4096 <== that's what you need
  46. ODS version 11.1
  47. . . . . . . .
  48. You may use nbackup output directly in a script, performing
  49. database backup:
  50. # DbFile=/dev/sda7
  51. # DbSize=`nbackup -L $DbFile -S` || exit 1
  52. # dd if=$DbFile ibs=4k count=$DbSize | # compress and record DVD
  53. # nbackup -N $DbFile
  54. Or perform physical backup using nbackup:
  55. # nbackup -B 0 /dev/sda7 /tmp/lvl.0
  56. In all other aspects raw devices do not have known specific
  57. in use.
  58. Tip: it's good idea to have raw devices in databases.conf - in
  59. case of HW reconfiguration of your server you will not need to
  60. change connection strings.