Problem: Samba logs tdb_expand overflow detected current map_size[4294967295] size[3092264]

Problem

Samba logs messages like the following one:
ldb: ltdb: tdb(/var/lib/samba/private/sam.ldb.d/DC=XXX,DC=XXX.ldb): tdb_expand overflow detected current map_size[4294967295] size[3092264]!

And the Samba database has a size of 4 GB:

root@master:~ # ls -la /var/lib/samba/private/sam.ldb.d/DC\=XXX\,DC\=XXX.ldb
-rw------- 1 root root 4294967295 Jan 21 16:52 DC=XXX,DC=XXX.ldb

Solution

The Samba database has to be rebuild:

root@master:~ # /etc/init.d/samba stop
[ ok ] Stopping samba-ad-dc (via systemctl): samba-ad-dc.service.
[ ok ] Stopping smbd (via systemctl): smbd.service.
[ ok ] Stopping nmbd (via systemctl): nmbd.service.

root@master:~ # tdbtool /var/lib/samba/private/sam.ldb.d/DC\=XXX,DC\=XXX.ldb info
Size of file/data: 4294967295/1662903482
Header offset/logical size: 0/4294967295
Number of records: 1961889
Incompatible hash: no
Active/supported feature flags: 0x00000000/0x00000001
Robust mutexes locking: no
Smallest/average/largest keys: 12/41/183
Smallest/average/largest data: 72/806/2973219
Smallest/average/largest padding: 4/238/2833738
Number of dead records: 1
Smallest/average/largest dead records: 1905774568/1905774568/1905774568
Number of free records: 282789
Smallest/average/largest free records: 12/719/25440
Number of hash chains: 10000
Smallest/average/largest hash chains: 67/196/315
Number of uncoalesced records: 17
Smallest/average/largest uncoalesced runs: 1/1/1
Percentage keys/data/padding/free/dead/rechdrs&tailers/hashes: 2/37/11/5/44/1/0

root@master:~ # tdbbackup /var/lib/samba/private/sam.ldb.d/DC\=XXX\,DC\=XXX.ldb

root@master:~ # mkdir /root/samba-backup

root@master:~ # mv /var/lib/samba/private/sam.ldb.d/DC\=XXX\,DC\=XXX.ldb /root/samba-backup/

root@master:~ # mv /var/lib/samba/private/sam.ldb.d/DC\=XXX\,DC\=XXX.ldb.bak /var/lib/samba/private/sam.ldb.d/DC\=XXX\,DC\=XXX.ldb

root@master:~ # tdbtool /var/lib/samba/private/sam.ldb.d/DC\=XXX\,DC\=XXX.ldb info
Size of file/data: 2249986048/1662852718
Header offset/logical size: 0/2249986048
Number of records: 1961890
Incompatible hash: no
Active/supported feature flags: 0x00000000/0x00000001
Robust mutexes locking: no
Smallest/average/largest keys: 12/41/183
Smallest/average/largest data: 72/806/2973219
Smallest/average/largest padding: 25/216/743315
Number of dead records: 0
Smallest/average/largest dead records: 0/0/0
Number of free records: 34
Smallest/average/largest free records: 12/3365512/114425464
Number of hash chains: 10000
Smallest/average/largest hash chains: 67/196/315
Number of uncoalesced records: 0
Smallest/average/largest uncoalesced runs: 0/0/0
Percentage keys/data/padding/free/dead/rechdrs&tailers/hashes: 4/70/19/5/0/2/0

root@master:~ # ls -la /var/lib/samba/private/sam.ldb.d/DC\=XXX\,DC\=XXX.ldb info
-rw------- 1 root root 2249986048 Jan 21 16:55 DC=XXX,DC=XXX.ldb

root@master:~ # /etc/init.d/samba restart
[ ok ] Stopping samba-ad-dc (via systemctl): samba-ad-dc.service.
[ ok ] Stopping smbd (via systemctl): smbd.service.
[ ok ] Stopping nmbd (via systemctl): nmbd.service.
[ ok ] Starting nmbd (via systemctl): nmbd.service.
[ ok ] Starting smbd (via systemctl): smbd.service.
[ ok ] Starting samba-ad-dc (via systemctl): samba-ad-dc.service.

root@master:~ # /etc/init.d/bind9 restart
[ ok ] Restarting bind9 (via systemctl): bind9.service.

This topic was automatically closed after 24 hours. New replies are no longer allowed.