[Samba] samba_backup script doesn't use tdbbackup for tdb files?

mail at crcomp.net mail at crcomp.net
Sat Dec 10 20:19:11 UTC 2016

Rowland Penny via samba <samba at lists.samba.org> wrote:
> On 09 Dec 2016 21:52:39 UTC
> Don via samba <samba at lists.samba.org> wrote:
>> Greetings,
>> The backup and restore Samba AD DC section of SambaWiki [1] refers to
>> ./source4/scripting/bin/samba_backup . Although my recent version of
>> samba_backup uses tdbbackup on ldb files, it appears to tar tdb files
>> "as is." [2]
>> What gives? Isn't tdbbackup specifically designed to backup tdb
>> files? Is it now possible to simply copy open tdb files into an
>> archive?
>> Note.
>> 1. https://wiki.samba.org/index.php/Backup_and_restore_an_Samba_AD_DC
>> 2. script snippet sans error handling
>>      if [ "$d" = "private" ]; then
>>        find $relativedirname -name "*.ldb.bak" -exec rm {} \;
>>          for ldb in `find $relativedirname -name "*.ldb"`; do
>>            tdbbackup $ldb
>>          done
>>          tar cjf ${WHERE}/samba4_${n}.${WHEN}.tar.bz2
>> $relativedirname --exclude=*.ldb >/dev/null 2>&1
>> Thank you,
> If you read the code snippet carefully, you will see that tdbbackup
> backs up each .ldb file 'tdbbackup $ldb', this results in files named
> *.ldb.bak.
> The script then goes on to create a tarball of all the files EXCEPT
> the original *.ldb files, this is done by this '--exclude=*.ldb'

My question pertains to *.tdb files (not *.ldb files). Allow me to
unpack the samba_backup snippet.

    It first removes any *.ldb.bak files that it finds because they were 
    created by an earlier invocation of samba_backup.

    It next uses tdbbackup to create *.ldb.bak files for this invocation
    of samba_backup.
    If finally uses tar to create an archive of all *.ldb.bak files,
    all *.tdb files, and every other type of file, except *.ldb files.
    Presumably samba_backup excludes *.ldb files because they are 
    open and in an unbackupable state.

Given its name, tdbbackup seems to imply that at one point, you needed
to use tdbbackup to backup *.tdb files that were open and therefore in
an unbackupable state. Then something apparently changed, which allowed
*.tdb files that were open to be backed up with tar.

In the end my questions remain:

    Does tar create a usable backup of *.tdb files?

    Why is tdbbackup named tdbbackuup instead of ldbbackup if it's only
    used with *.ldb files? (Is tdbbackuup simply a legacy name that's
    no longer apropos to *.tdb files?)  

Thank you,

Don Kuenz KB7RPU

Genius is nothing but a greater aptitude for patience. - de Buffon

More information about the samba mailing list