[Samba] Users and groups named in Russian disappeared after upgrade samba4 PDC

Vitaly Pyslar pyslarvt at gmail.com
Thu Mar 12 16:46:40 MDT 2015

> > I tried to restore some different backups that have been made in different
> > days and months. No one of them worked. Have all my backups been making
> > broken? To backing up I use the instruction from this page 
> > https://wiki.samba.org/index.php/Backup_and_Recovery with little
> > modifications, but I didn't try to restore it before the fault.
> What modifications?

There is written in instruction:

How LDB and TDB files can be backed-up/restored.
you can backup *.ldb & *.tdb files online with 'tdbbackup'

But the provided script doesn't make baskups of *.tdb files, only *.ldb so I 
decided to backup both of them. This is my backup script:




DATE=$(date +%y%m%d)

if [ ! -d $BACKUPDIR ]
        echo "Missing backup directory $BACKUPDIR"
        exit 1

if [ -f $BACKUPDIR/$DATE.tar.bz2 ]
        echo "Backup $DATE.tar.bz2 already exists"
        exit 1

if [ -d $BACKUPDIR/$DATE ]
        rm -rf $BACKUPDIR/$DATE

find /var/lib/samba -type f \( -name "*.ldb.bak" -o -name "*.tdb.bak" \) -exec 
rm -f {} \;

for db in $(find /var/lib/samba -type f \( -name "*.ldb" -o -name "*.tdb" \))
        tdbbackup $db

        if [ $? -ne 0 ]; then
                echo "Error while backuping $db"
                exit 1

rsync -aX --exclude='usershares' --exclude='*.ldb' --exclude='*.tdb' 
/var/lib/samba/* $BACKUPDIR/$DATE/

mkdir $BACKUPDIR/$DATE/etc
cp -dpR /etc/samba/* $BACKUPDIR/$DATE/etc/


for db in $(find . -type f \( -name "*.ldb.bak" -o -name "*.tdb.bak" \))
        mv $db ${db%.bak}

tar -cjf $DATE.tar.bz2 $DATE >/dev/null 2>&1

rm -rf $DATE

find /var/lib/samba -type f \( -name "*.ldb.bak" -o -name "*.tdb.bak" \) -exec 
rm -f {} \;

find . -name "*.tar.bz2" -mtime +$DAYS -exec rm {} \;

exit 0


Is it correct?
It is launched by cron every night.

To restore a backup I stopped the samba service, removed contents of the 
/var/lib/samba directory, untared the archive there and started the service 
again. I tried to restore the backup of the previous day, the prevous week and 
the previous month.

> And what was wrong with the restored backup? Did it has the same
> problems? Or why it wasn't usable?

There was no success, the problem didn't disappear. I know it's a some kind of 
mistery. Only one logical explanation that I see is that in some point of time 
my database has become corrupted (don't know why and how) and all the backups 
have been made with broken data. Long running DC has been working somehow 
until upgrade restarted it and after that the problem appeared. Hense the 
reason of the fault might be not the upgrade, it could have happened before 
somewhere else. I don't know what could it be, all that I've done since then I 
have installed the DC added/removed users via ADUC.

> Do you just have one DC?
Yes. I know I had to have a secondary domain member server for redundancy but 
unfortunately I don't have it right now. The company I talk about is very 
small, the hardware of the current server is quite powerful and reliable so 
they won't to buy one more server only for another samba instance. I decided 
to run both DCs - primary and secondary in separate lxc-containers or in  
virtual maschines and snapshot them periodically. I hope it will help me to 
restore quickly the whole environment in case of a fault.

Thanks a lot for your help.

More information about the samba mailing list