How to Backup Samba Domain Controller Configuration in Linux

by Vadiraj Joish on June 11, 2014

We have ntbackup in Windows where we can take the “system state backup” for backing up the domain controller.

This tutorial explains how we can backup the Samba configuration, after you’ve setup Samba as active directory domain controller in Linux.

First, we need to understand what files and folders we are going to backup, and what tools we need to scheduled samba backup.

For Samba, we need to backup two database called as LDB and TDB. We are also looking at backing up the configuration files and sysvol .

What is LDB?

LDB is nothing but LDAP like database. This provides a fast database along with an LDAP-like API. In simple terminology LDB works as a intermediate between TDB and real LDAP database. Refer to this LDB website for more information.

What is TDB?

TDB stands for Trivial DataBase. Its a key/value pair database. Each value has a key with some data associated with it. It performs tasks like tdb_open, tdb_close, tdb_delete, tdb_exists,tdb_fetch and tdb_store. Refer to TDB website for more information.

What is Sysvol?

Sysvol stands for System Volume, which is nothing but a shared directory that stores public files which are needed for common access and replication throughout a domain.

So we are looking at backing up the databases, configuration files, and sysvol folder.

If you are new to Samba, you should first understand how to setup Samba domain controller.

Samba Server comes with a basic backup script. Using this script, you need to modify the source and target and schedule it with Crontab.

Samba backup utilities are part of tdb-tools package. Install it as shown below:

# yum install tdb-tools

Instead of writing your own backup shell script, you can use the default script that caomes as part of the samba source code.

Copy samba_backup script from this directory source4/scripting/bin/ to /usr/sbin directory.

If you’ve extracted the samba source under /usr/src, do the following:

cd /usr/src
cd source4/scripting/bin/
cp samba_backup /usr/sbin

Also, make sure the samba_backup script is owned by root, and root has execute permission.

In the samba_backup script, you can change the values of the following three parameters based on your specific configuration:

  1. FROM=/usr/local/samba
  2. WHERE=/backup
  3. DAYS=30

Add the samba_backup script to the crontab to take regular backups.

When samba backup script runs, it will create three files under the /backup directory as shown below.

$ ls -l
-rw-r--r-- 1 root root 366 May 14 12:53 etc.2014-05-14.tar.bz2 
-rw-r--r-- 1 root root 12M May 14 12:53 samba4_private.2014-05-14.tar.bz2 
-rw-r--r-- 1 root root 475 May 14 12:53 sysvol.2014-05-14.tar.bz2

Linux Sysadmin Course Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.
Get the Linux Sysadmin Course Now!

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: