samba-tool domain backup and xattrs

Rowland Penny rpenny at samba.org
Tue Apr 10 08:15:32 UTC 2018


On Mon, 09 Apr 2018 23:13:23 +1200
Andrew Bartlett <abartlet at samba.org> wrote:

> On Mon, 2018-04-09 at 12:01 +0100, Rowland Penny wrote:
> > 
> > The fix, change:
> > 
> >         up_from_private =
> > os.path.abspath(os.path.join(p.private_dir, '..')) backup_dirs =
> > [p.private_dir, p.state_dir, p.sysvol,
> > os.path.join(up_from_private, 'etc')]
> > 
> > To:
> > 
> >         backup_dirs = [p.private_dir, p.state_dir, p.sysvol,
> >                        os.path.dirname(p.smbconf)]
> 
> Thanks.  This is really helpful to have picked up!
> 
> > > 
> > > To be clear, the locking on the sh script is unsafe.  It was
> > > written before we understood the need for global locking of the
> > > sam.ldb, so needs to be replaced.
> > > 
> > > Unsafe locking, particularly of the type seen here (because the
> > > per-db and per-record locks are still respected) is dangerous
> > > because it appears to work most of the time, but can be subtly
> > > corrupt.
> > 
> > Then get the tdbbackup changes into Samba and backport them, there
> > are people running variants of the 'sh' script and you have now
> > admitted they are not safe.
> 
> To be clear, tdbbackup -r isn't enough.  It just allows the locking of
> the full database tree.  That is done in the python script using
> transactions from the ldb python bindings. 
> 
> Thank you for your feedback above and I hope this clarifies why it
> isn't possible to implement this safely in sh.
> 
> Andrew Bartlett
> 

OK, another day, another question ;-)

In the previously posted python backup script there is:

+        logger.info('running backup on dirs: {}'.format(backup_dirs))

Now whilst trying to understand why '.format' was being used instead
of '%s', I made the script print out the result both ways and this is
the result:

running backup on dirs: ['/var/lib/samba/private', '/var/lib/samba', '/var/lib/samba/sysvol', '/etc/samba']
running backup on dirs: ['/var/lib/samba/private', '/var/lib/samba', '/var/lib/samba/sysvol', '/etc/samba']

Apart from there being no difference in output (can you tell which is
which), it raises the question, why is the 'statedir' being backed
up ???

Rowland
 



More information about the samba-technical mailing list