I try to keep Samba servers up to date at least on a weekly basis. This is my routine:
You can locally back up your domain and save this file for disaster recovery purposes, but:
samba-tool domain backup online --targetdir=/backup/dc1/ --server=dc1 -U "MAD\Administrator"
Please be aware that in recent Samba versions (>4.20), both `samba-ad-provision` and `samba-dsdb-modules` packages are needed to perform a backup. If you are running this on a DC, chances are these are already installed.
samba-tool domain tombstones expunge --tombstone-lifetime=0
samba-tool dbcheck --cross-ncs --fix --yes
samba-tool visualize uptodateness -rS --utf8
samba-tool fsmo show | cut -f1-2 -d,
chronyc tracking && timedatectl status
apt-get update && apt-get dist-upgrade && apt autoremove -y && apt-get autoclean && apt-get clean && apt-get remove --purge $(dpkg -l | awk '/^rc/{print $2}')
It is very important to have SysVol and idmap.ldb synced from the PDC FSMO role owner.
Also, if you have transferred FSMO roles, I suggest you check the DNS entries for the PDC Emulator role. See PDC FSMO DNS entry check.
I suggest you script this and run it on a regular basis.
Caponato's Samba notebook. Start here or return to Main menu.