18.12 The Printing .tdb Files


18.12 The Printing *.tdb Files

Some mystery is associated with the series of files with a tdb suffix appearing in every Samba installation. They are connections.tdb , printing.tdb , share_info.tdb , ntdrivers.tdb , unexpected.tdb , brlock.tdb , locking.tdb , ntforms.tdb , messages.tdb , ntprinters.tdb , sessionid.tdb and secrets.tdb . What is their purpose?

18.12.1 Trivial Database Files

A Windows NT (print) server keeps track of all information needed to serve its duty toward its clients by storing entries in the Windows registry. Client queries are answered by reading from the registry, Administrator or user configuration settings that are saved by writing into the registry. Samba and UNIX obviously do not have such a Registry. Samba instead keeps track of all client related information in a series of *.tdb files. (TDB = Trivial Data Base). These are often located in /var/lib/samba/ or /var/lock/samba/ . The printing related files are ntprinters.tdb , printing.tdb , ntforms.tdb and ntdrivers.tdb .

18.12.2 Binary Format

*.tdb files are not human readable. They are written in a binary format. " Why not ASCII? ", you may ask. " After all, ASCII configuration files are a good and proven tradition on UNIX ." The reason for this design decision by the Samba team is mainly performance. Samba needs to be fast; it runs a separate smbd process for each client connection, in some environments many thousands of them. Some of these smbds might need to write-access the same *.tdb file at the same time . The file format of Samba's *.tdb files allows for this provision. Many smbd processes may write to the same *.tdb file at the same time. This wouldn't be possible with pure ASCII files.

18.12.3 Losing *.tdb Files

It is very important that all *.tdb files remain consistent over all write and read accesses . However, it may happen that these files do get corrupted. (A kill -9 'pidof smbd' while a write access is in progress could do the damage as well as a power interruption, etc.). In cases of trouble, a deletion of the old printing-related *.tdb files may be the only option. After that you need to re-create all print-related setup or you have made a backup of the *.tdb files in time.

18.12.4 Using tdbbackup

Samba ships with a little utility that helps the root user of your system to backup your *.tdb files. If you run it with no argument, it prints a usage message:

 
 root# tdbbackup Usage: tdbbackup [options] <fname...> Version:3.0a -h this help message -s suffix set the backup suffix -v verify mode (restore if corrupt) 

Here is how I backed up my printing.tdb file:

 
 root# ls . browse.dat locking.tdb ntdrivers.tdb printing.tdb .. share_info.tdb connections.tdb messages.tdb ntforms.tdb printing.tdbkp unexpected.tdb brlock.tdb gmon.out namelist .debug ntprinters.tdb sessionid.tdb root# tdbbackup -s .bak printing.tdb printing.tdb : 135 records root# ls -l printing.tdb* -rw------- 1 root root 40960 May 2 03:44 printing.tdb -rw------- 1 root root 40960 May 2 03:44 printing.tdb.bak 


Official Samba-3 HOWTO and Reference Guide
The Official Samba-3 HOWTO and Reference Guide, 2nd Edition
ISBN: 0131882228
EAN: 2147483647
Year: 2005
Pages: 297

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net