Backing up samba4

Andrew Bartlett abartlet at
Wed Sep 19 12:09:59 MDT 2012

On Wed, 2012-09-19 at 20:04 +0200, Marc Muehlfeld wrote:
> Am 19.09.2012 19:03, schrieb Andrew Bartlett:
> > tdbbackup creates a second, live and ready-to-use tdb that can then be
> > copied because nothing else is using it.  The other command pair you are
> > trying to refer to to tdbdump and tdbrestore, which creates a larger
> > text file representations of the data, and creates a fresh tdb from that
> > text file.  These are really more development tools, but could be useful
> > in some very, very low level debugging situations.  This is not needed
> > for typical backup/restore.
> If I can just rename the *.ldb.bak to *.ldb then it's easy in a case of 
> restore. And I can get a backup of the databases without shuting down samba.
> But then I have a question for curiosity: Are the files compacted or something 
> by tdbbackup? Because I saw, that the *.bak files are always smaller then the 
> originals:
> -rw-------  1 root root 412K  8. Sep 09:46 account_policy.tdb
> -rw-------  1 root root  36K 13. Sep 20:55 account_policy.tdb.bak
> -rw-------  1 root root 516K  8. Sep 09:46 registry.tdb
> -rw-------  1 root root  52K 13. Sep 20:55 registry.tdb.bak
> -rw-------  1 root root 412K 12. Sep 17:19 share_info.tdb
> -rw-------  1 root root  48K 13. Sep 20:55 share_info.tdb.bak

Yes, because the process is to read the DB, then write each record in
order into the new file, it will not leave free space between the

The degree of the size difference is due to the fact that when we
enlarge a tdb due to being out of space, we make it significantly larger
(to avoid doing that again soon). 

Andrew Bartlett

Andrew Bartlett                      
Authentication Developer, Samba Team 

More information about the samba-technical mailing list