Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

65 views
Skip to first unread message

Rowland Penny via samba

unread,
Dec 10, 2016, 3:10:02 AM12/10/16
to
On 09 Dec 2016 21:52:39 UTC
Don via samba <sa...@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'

Rowland

--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba

Rowland Penny via samba

unread,
Dec 10, 2016, 4:30:02 PM12/10/16
to
On 10 Dec 2016 20:19:11 UTC

Don via samba <sa...@lists.samba.org> wrote:

> 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.

As far as I am aware, nothing has changed, you still need to
backup .tdb files with tdbbackup and yes, it also backs up .ldb files

You will find a better backup script here:

https://github.com/thctlo/samba4/tree/master/backup-script

This one backs up .ldb & .tdb files before creating the tarball

0 new messages