[Samba] safe to replace just one ldb file?

mourik jan heupink - merit heupink at merit.unu.edu
Tue Sep 2 10:03:11 MDT 2014


Hi all,

Ok, I took a deep breath and I

- shutdown samba DC on the specific host *only*
- took a good backup of the /var/lib/samba dir
- tdbbackupped all tdb & ldb files in
  /var/lib/samba/private/sam.ldb.d, namely:
	CN=CONFIGURATION...
	CN=SCHEMA...
	DC=DOMAINDNSZONES...
	DC=FORESTDNSZONES...
	DC=SAMBA...
	metadata.tdb
	sam.ldb

Then swapped all 7 files, using lines like:
  mv sam.ldb sam.ldb.deleted
  cp sam.ldb.backup sam.ldb
and
  mv "CN=CONFIGURATION..." "CN=CONFIGURATION....deleted"
  cp "CN=CONFIGURATION....backup" "CN=CONFIGURATION...ldb"

Then I started samba again, while looking at /var/log/samba/log.samba, 
and noticed a few replications, and no errors at all.

Then checked samba-tool drs showrepl on *all* DC's, no errors, and 
latest replication was a few minutes ago. (after the ldb/tdb swap)

ADUC showed all DC's as online, and then as final confirmation: 
samba-tool ldapcmp between our three DC's, and no differences reported. 
Directory size for /var/lib/samba/private/sam.ldb.d went down from 1.2GB 
to approx 53 MB.

So all in all things still look healthy, and I guess tdbbackup can 
actually dump ldb and tdb files. :-)

Drink some water before doing this excersise, as you may sweat a bit 
(scary stuff...) but in the end you gain a lot of diskspace.

MJ


More information about the samba mailing list