[Samba] Can I restore a Samba instance from an rsync backup?

Stacey Richards stacey at synapp.nz
Wed Oct 14 08:23:40 UTC 2020


I have Samba 4.3.11 running as an ADDC on Ubuntu 14.04.

When I run samba-tool dbcheck, I get the following output:

tdb_rec_read bad magic 0x3f3f3f3f at offset=2993916

ERROR(ldb): uncaught exception - Indexed and full searches both failed!

  File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line
176, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/dbcheck.py", line
157, in run
    controls=controls, attrs=attrs)
  File "/usr/lib/python2.7/dist-packages/samba/dbchecker.py", line 208, in
    res = self.samdb.search(base=DN, scope=scope, attrs=['dn'],

Every night, the server is backed up using rsync to a remote location.
Recently, every time
/var/lib/samba/private/sam.ldb.d/DC=CORP,DC=EXAMPLE,DC=CO,DC=NZ.ldb is
copied to the remote location, rsync reports: Input/output error (5)

I have installed Ubuntu 14.04 on a virtual machine and installed Samba.
I've copied the contents of /etc/samba and /var/lib/samba from the last
known good rsync backup to the virtual machine. I finally ran samba-tool
ntacl sysvolreset.

When I run samba-tool dbcheck on the virtual machine with the restored
Samba files, I get the following output:
Checking 293 objects
Checked 293 objects (0 errors)

I've installed Windows 10 on another virtual machine and joined it to the
recovered domain. I've installed  Remote Server Administration Tools on
this Windows 10 machine and run Active Directory Users and Computers. It
lists the users and computers as expected.

Can I assume that restoring /etc/samba and /var/lib/samba, then running
samba-tool ntacl sysvolreset has left Samba in a healthy state or should I
have used tdbbackup to backup the tdb/ldb files to be sure I have a good

Many thanks in advance for your time and advice.

Kind regards,

Stacey Richards

More information about the samba mailing list