1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
8 <pubdate>May 28, 2008</pubdate>
11 <title>Managing TDB Files</title>
14 <title>Features and Benefits</title>
17 <indexterm><primary>tdb</primary></indexterm>
18 <indexterm><primary>Trivial Database</primary></indexterm>
19 Samba uses a lightweight database called Trivial Database (tdb) in which it stores persistent and transient data.
20 Some tdb files can be disposed of before restarting Samba, but others are used to store information that is vital
21 to Samba configuration and behavior. The following information is provided to help administrators who are seeking
22 to better manage their Samba installations.
26 <indexterm><primary>tdb</primary></indexterm>
27 <indexterm><primary>corrupted</primary></indexterm>
28 <indexterm><primary>backup</primary></indexterm>
29 <indexterm><primary>restore</primary></indexterm>
30 Those who package Samba for commercial distribution with operating systems and appliances would do well to take
31 note that tdb files can get corrupted, and for this reason ought to be backed up regularly. An appropriate time
32 is at system shutdown (backup) and startup (restore from backup).
35 <table frame="all" id="TOSH-TDB">
36 <title>Samba's Trivial Database Files</title>
37 <tgroup align="center" cols="2">
39 <row><entry>File name</entry><entry>Preserve</entry><entry>Description</entry></row>
43 <row><entry>account_policy.tdb</entry><entry>Y</entry>
44 <entry><para>NT account policy settings such as pw expiration, etc...</para></entry></row>
45 <row><entry>brlock.tdb</entry><entry>N</entry>
46 <entry><para>Byte range locks.</para></entry></row>
47 <row><entry>browse.dat</entry><entry>N</entry>
48 <entry><para>Browse lists - gets rebuilt automatically.</para></entry></row>
49 <row><entry>connections.tdb</entry><entry>N</entry>
50 <entry><para>Share connections. Used to enforce max connections, etc.</para></entry></row>
51 <row><entry>gencache.tdb</entry><entry>N</entry>
52 <entry><para>Generic caching database.</para></entry></row>
53 <row><entry>group_mapping.tdb</entry><entry>Y</entry>
54 <entry><para>Stores group mapping information. Not used when using LDAP backend.</para></entry></row>
55 <row><entry> lang_en.tdb</entry><entry>Y</entry>
56 <entry><para>Stores language encoding information.</para></entry></row>
57 <row><entry>locking.tdb</entry><entry>N</entry>
58 <entry><para>Stores share mode and oplock information.</para></entry></row>
59 <row><entry>login_cache.tdb</entry><entry>N</entry>
60 <entry><para>Keeps a log of bad pw attempts.</para></entry></row>
61 <row><entry>messages.tdb</entry><entry>N</entry>
62 <entry><para>Used to keep track of Samba internal messaging.</para></entry></row>
63 <row><entry>netsamlogon_cache.tdb</entry><entry>Y</entry>
65 Cache of user net_info_3 struct from <emphasis>net_samlogon()</emphasis>
66 requests from domain member machines.
68 <row><entry>ntdrivers.tdb</entry><entry>Y</entry>
69 <entry><para>Stores installed printer driver information.</para></entry></row>
70 <row><entry>ntforms.tdb</entry><entry>Y</entry>
71 <entry><para>Stores installed printer forms information.</para></entry></row>
72 <row><entry>ntprinters.tdb</entry><entry>Y</entry>
73 <entry><para>Stores installed printers information.</para></entry></row>
74 <row><entry>printing directory</entry><entry>Y</entry>
75 <entry><para>Directory containing tdb per print queue of cached lpq output.</para></entry></row>
76 <row><entry>registry.tdb</entry><entry>Y</entry>
77 <entry><para>Windows registry skeleton (connect via regedit.exe).</para></entry></row>
78 <row><entry>sessionid.tdb</entry><entry>N</entry>
79 <entry><para>Session information to support <literal>utmp = yes</literal> capabilities.</para></entry></row>
80 <row><entry>share_info.tdb</entry><entry>Y</entry>
81 <entry><para>Stores share-level ACL configuration settings.
82 Default ACL is <emphasis>Everyone - Full Control</emphasis>.
84 <row><entry>unexpected.tdb</entry><entry>N</entry>
86 Unexpected packet queue needed to support windows clients that respond on a
87 different port that the originating reques.
89 <row><entry>winbindd_cache.tdb</entry><entry>N</entry>
90 <entry><para>Winbind's cache of user lists.</para></entry></row>
91 <row><entry>winbindd_idmap.tdb</entry><entry>Y</entry>
92 <entry><para>Winbind's local IDMAP database.</para></entry></row>
93 <row><entry>wins.dat</entry><entry>N</entry>
95 WINS database iused only when <parameter>wins support = yes</parameter>
96 has been set. This gets rebuilt or updated at every restart.
98 <row><entry>wins.tdb</entry><entry>Y</entry>
100 The working permanent storage for all WINS data. This database is used only
101 when <parameter>wins support = yes</parameter> has been set in the &smb.conf; file.
102 Note: This retains all manually configured WINS entries. Manual setting can be done use the net utility.
103 </para></entry></row>
104 <row><entry>secrets.tdb</entry><entry>Y</entry>
106 This tdb file stores internal settings such as the machine and the domain SID, secret passwords
107 that are used with LDAP, the machine secret token, etc. This is an essential file that is stored
108 in a secure area. Vendors locate this in various folders. Check <command>smbd -b</command> to
109 find its location on your system.
110 </para></entry></row>
111 <row><entry>schannel_store.tdb</entry><entry>Y</entry>
113 This stores secure channel access token information used with SMB signing.
114 </para></entry></row>
115 <row><entry>passdb.tdb</entry><entry>Y</entry>
117 This stores the Samba SAM account information when using a tdbsam password backend.
118 </para></entry></row>
126 <title>Managing TDB Files</title>
129 The <command>tdbbackup</command> utility is a tool that may be used to backup samba tdb files.
130 This tool may also be used to verify the integrity of the tdb files prior to Samba startup or
131 during normal operation. If it finds file damage it will search for a prior backup the backup
132 file from which the damaged tdb file will be restored. The <command>tdbbackup</command>
133 utility can safely be run at any time. It was designed so that it can be used at any time to
134 validate the integrity of tdb files, even during Samba operation.
138 It is recommended to backup all tdb files as part of the Samba start-up scripts on a Samba
139 server. The following command syntax can be used:
142 myserver# > cd /var/lib/samba
143 myserver@ > tdbbackup *.tdb
146 The default extension is <filename>.bak</filename>. Any alternate extension can be specified
147 by executing <literal>tdbbackup -s 'new_extension' *.tdb</literal> as part of your startup script.