| 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"> | 
|---|
| 3 | <chapter id="tdb"> | 
|---|
| 4 |  | 
|---|
| 5 | <chapterinfo> | 
|---|
| 6 | &author.jht; | 
|---|
| 7 |  | 
|---|
| 8 | <pubdate>May 28, 2008</pubdate> | 
|---|
| 9 | </chapterinfo> | 
|---|
| 10 |  | 
|---|
| 11 | <title>Managing TDB Files</title> | 
|---|
| 12 |  | 
|---|
| 13 | <sect1> | 
|---|
| 14 | <title>Features and Benefits</title> | 
|---|
| 15 |  | 
|---|
| 16 | <para> | 
|---|
| 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. | 
|---|
| 23 | </para> | 
|---|
| 24 |  | 
|---|
| 25 | <para> | 
|---|
| 26 | <indexterm><primary>tdb</primary></indexterm> | 
|---|
| 27 | <indexterm><primary>currupted</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). | 
|---|
| 33 | </para> | 
|---|
| 34 |  | 
|---|
| 35 | <table frame="all" id="TOSH-TDB"> | 
|---|
| 36 | <title>Samba's Trivial Database Files</title> | 
|---|
| 37 | <tgroup align="center" cols="2"> | 
|---|
| 38 | <thead> | 
|---|
| 39 | <row><entry>File name</entry><entry>Preserve</entry><entry>Description</entry></row> | 
|---|
| 40 | </thead> | 
|---|
| 41 |  | 
|---|
| 42 | <tbody> | 
|---|
| 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> | 
|---|
| 64 | <entry><para> | 
|---|
| 65 | Cache of user net_info_3 struct from <emphasis>net_samlogon()</emphasis> | 
|---|
| 66 | requests from domain member machines. | 
|---|
| 67 | </para></entry></row> | 
|---|
| 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>. | 
|---|
| 83 | </para></entry></row> | 
|---|
| 84 | <row><entry>unexpected.tdb</entry><entry>N</entry> | 
|---|
| 85 | <entry><para> | 
|---|
| 86 | Unexpected packet queue needed to support windows clients that respond on a | 
|---|
| 87 | different port that the originating reques. | 
|---|
| 88 | </para></entry></row> | 
|---|
| 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> | 
|---|
| 94 | <entry><para> | 
|---|
| 95 | WINS database iused only when <parameter>wins support = yes</parameter> | 
|---|
| 96 | has been set. This gets rebuilt or updated at every restart. | 
|---|
| 97 | </para></entry></row> | 
|---|
| 98 | <row><entry>wins.tdb</entry><entry>Y</entry> | 
|---|
| 99 | <entry><para> | 
|---|
| 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> | 
|---|
| 105 | <entry><para> | 
|---|
| 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> | 
|---|
| 112 | <entry><para> | 
|---|
| 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> | 
|---|
| 116 | <entry><para> | 
|---|
| 117 | This stores the Samba SAM account information when using a tdbsam password backend. | 
|---|
| 118 | </para></entry></row> | 
|---|
| 119 | </tbody> | 
|---|
| 120 | </tgroup> | 
|---|
| 121 | </table> | 
|---|
| 122 |  | 
|---|
| 123 | </sect1> | 
|---|
| 124 |  | 
|---|
| 125 | <sect1> | 
|---|
| 126 | <title>Managing TDB Files</title> | 
|---|
| 127 |  | 
|---|
| 128 | <para> | 
|---|
| 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. | 
|---|
| 135 | </para> | 
|---|
| 136 |  | 
|---|
| 137 | <para> | 
|---|
| 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: | 
|---|
| 140 | </para> | 
|---|
| 141 | <screen> | 
|---|
| 142 | myserver# > cd /var/lib/samba | 
|---|
| 143 | myserver@ > tdbbackup *.tdb | 
|---|
| 144 | </screen> | 
|---|
| 145 | <para> | 
|---|
| 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. | 
|---|
| 148 | </para> | 
|---|
| 149 |  | 
|---|
| 150 | </sect1> | 
|---|
| 151 |  | 
|---|
| 152 | </chapter> | 
|---|