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

Rowland penny rpenny at samba.org
Wed Oct 14 08:45:30 UTC 2020

On 14/10/2020 09:23, Stacey Richards via samba wrote:
> Hello,
> I have Samba 4.3.11 running as an ADDC on Ubuntu 14.04.
Both Samba 4.3.11 and Ubuntu 14.04 are EOL
> When I run samba-tool dbcheck, I get the following output:
> ltdb:
> tdb(/var/lib/samba/private/sam.ldb.d/DC=CORP,DC=EXAMPLE,DC=CO,DC=NZ.ldb):
> 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
> check_database
>      res = self.samdb.search(base=DN, scope=scope, attrs=['dn'],
> controls=controls)
> Every night, the server is backed up using rsync to a remote location.
That was your first mistake, you can backup your system with rsync, but 
you shouldn't use it to backup Samba when running as a DC.
> 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
> restore?
No, you cannot assume that your DC is healthy and yes, you should have 
used tdbbackup. You should also have updated your system on a regular 
basis, especially when it comes to Samba. Samba is rapidly improving all 
the time and there have been numerous updates between your version and 
the latest (4.13.0), one of which is a new backup system.


More information about the samba mailing list