How To Backup SAMBA Server Configuration

Hi Experts,

Samba noob here. I currently have Debian 7 with Samba 3.6.6 installed.  I've been looking around for tutorials on backing up my Samba server. I have purchased a book call The Official Samba-3 Howto and Reference Guide but was hoping to make some progress on my own before it arrives.

All I've found are the following websites:
1. Can't find the backup script in the following website.

2. Don't understand the part about the SIDs on this website here...

Please help point me in the right direction.

Many Thanks
Ricky NguyenITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The 2 sites indeed are pointing to a right direction. You have to tell us which portion you are not finding in these 2 sites to be right.......

"Can't find the backup script in the following website"--> what do you mean by this? Is it not written that---

 "The backup script of samba isn't installed, when you run 'make install'. It's recommented that you copy it from the sources directory (source4/scripting/bin/samba_backup) to your system, like /usr/sbin, and set secure permissions: "

If you know samba well, you know where the directories and files are, just cp the directories and files......... that's all.....

Ricky NguyenITAuthor Commented:
Thanks for posting surbabu. What is your approach to backing up Samba server?
Ricky NguyenITAuthor Commented:
Would you know of any other useful website? ones suitable for noobs?
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Ricky NguyenITAuthor Commented:
Are there any thing to watch out for when performing the backup?
just copying the directories and files would do, nothing else is required. In the backup script also, you need to mention the location and the script will only work if your installation is in the same directory.
The samba configuration files live in a directory called /etc/samba - just backup that directory.
Ricky NguyenITAuthor Commented:
what about the  *.tdb files as mentioned in the 2nd website?
Ricky NguyenITAuthor Commented:

Backup Procedure

On The Old Machine - Backup Samba Database & Config File

Backup Samba Database

1. Create backup archive directory
myserver1# mkdir /backup

2. Stop Samba service before performing the database backup
myserver1# service samba stop

3. Backp the trivial database located in /var/lib/samba.
myserver1# cd /var/lib/samba

4. Use the Samba tdbbackup utility to backup .tdb files. *.bak files will be created in the current location.
myserver1# tdbbackup *.tdb

5. Save a tar ball to /backup directory.
myserver1# tar -cvpzf /backup/sambadb.tar.gz *.bak

6. No longer require .bak files, just delete them.
myserver1# rm *.bak

Open in new window

Backup Samba Configuration Files

7. Backup config files located in /etc/samba
myserver1# cd /etc/samba

8. Save a tar ball of the config files to /backup directory
myserver1# tar -cvpzf /backup/sambaconf.tar.gz *

Open in new window

On The New Machine - Restore Samba Database & Config File

9. Create backup dump directory
myserver2# mkdir /dumpbkp

10. Copy backup files from Old machine over SSH.
myserver2# scp username@old_server_ip:/backup/* /dumpbkp

11. Stop Samba server running on the new machine.
myserver2# service samba stop

12. Extract tar ball containing the samba database.
myserver2# cd /dumpbkp
myserver2# tar -xvzf sambadb.tar.gz -C /var/lib/samba

13. Extract tar ball containing the samba config files.
myserver2# tar -xvzf sambaconf.tar.gz -C /etc/samba

14. Startup the Samba service.
myserver2# service samba start

Open in new window

The End.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ricky NguyenITAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for RiCzN's comment #a39516912

for the following reason:

It works.
Point should be awarded to  RiCzN. I guess deletion will be a wrong action here.
Point should be awarded to  RiCzN. I guess deletion will be a wrong action here.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.