Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Samba] how to backup samba ad domain

735 views
Skip to first unread message

Jules Houantonon

unread,
Jul 26, 2016, 6:30:03 AM7/26/16
to
Dear all,

i installed samba-sernet-ad on centos 7.2.

I read that samba_backup script it is available from the source code.

As, i do not installed samba from source code, how can i backup Samba AD on
my server ?

Thank you for helping

Regards

--
Jules HOUANTONON
*Phone* : (00229) 97578914
*Email *: jules...@gmail.com
*Skype* : houantonon
*linkedin* : www.linkedin.com/in/jhouantonon/en
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba

mathias dufresne

unread,
Jul 26, 2016, 6:50:03 AM7/26/16
to
By downloading the source and extracting the script?

More seriously, there are lot of ways to achieve backup of Samba AD. Chose
one, that one will be the good one.

The point regarding backup is not backup, but restoration. Here it's a bit
more complex as some files are hard links (when using Bind+DLZ as DNS back
end). Rights must also be set correctly. But that's almost easy.
During restoration of AD all DC must be stopped because all DC would try to
synchronize with the newly restored DC. Once that first step is done, you
will need to join each others DC to the restored one. Once again, this
re-join must be done with Samba services stopped (on joined client, not on
the restored one of course).

Backup / restoration is on my todo list, these were only thoughts assembled
during last months in expectation I reach one day that line of my todo list
: )

Rowland penny

unread,
Jul 26, 2016, 7:20:03 AM7/26/16
to
On 26/07/16 11:16, Jules Houantonon wrote:
> Dear all,
>
> i installed samba-sernet-ad on centos 7.2.
>
> I read that samba_backup script it is available from the source code.
>
> As, i do not installed samba from source code, how can i backup Samba AD on
> my server ?
>
> Thank you for helping
>
> Regards
>

The problem with getting the backup script from the source code is that
it is hardcoded for /usr/local/samba.

You only really need a backup script if you only have one DC, the best
way to backup your AD, add another DC.

If you do decide to backup your AD, you will have to decide when and how
often you create a backup, this is because infrequent backups are
worthless. Unless you are sure that your backup contains every change,
you could find yourself minus all changes made since the last backup.

Rowland

Jules Houantonon

unread,
Jul 26, 2016, 8:00:03 AM7/26/16
to
Thank you all for your feedback. I appreciate it.

I only have one DC, and i cannot install another one.

Please, now how can I adjust the backup script to work witch samba-sernet
package installation ?

Regards
--
Jules HOUANTONON
*Phone* : (00229) 97578914
*Email *: jules...@gmail.com
*Skype* : houantonon
*linkedin* : www.linkedin.com/in/jhouantonon/en

Rowland penny

unread,
Jul 26, 2016, 8:40:03 AM7/26/16
to
On 26/07/16 12:51, Jules Houantonon wrote:
> Thank you all for your feedback. I appreciate it.
>
> I only have one DC, and i cannot install another one.
>
> Please, now how can I adjust the backup script to work witch
> samba-sernet package installation ?
>
> Regards
>
>
>

OK, download a Samba4 tarball from the Samba website, it doesn't matter
which, they all have the same script.
Unpack it and move into the directory created, you will find the script
here: source4/scripting/bin/samba_backup

If you can write a bash script, you should be able to understand it, but
if not, the biggest problem would be the 'etc' dir, yours will be
/etc/samba, whilst the script expects it to be /usr/local/samba/etc

See how you go on, any questions, just ask.

L.P.H. van Belle

unread,
Jul 26, 2016, 8:40:03 AM7/26/16
to
Hi,

To save you guys some time.
Im not a github guru so, ignore the layout please..

I'm posting scipts in the future here.
https://github.com/thctlo/samba4

For now i added the backup_samba4 script which i use daily.
Rowland Penny and me did modify it.


Greetz,

Louis



> -----Oorspronkelijk bericht-----
> Van: samba [mailto:samba-...@lists.samba.org] Namens Jules Houantonon
> Verzonden: dinsdag 26 juli 2016 13:52
> Aan: Rowland penny
> CC: samba
> Onderwerp: Re: [Samba] how to backup samba ad domain

Kevin Davidson

unread,
Jul 26, 2016, 10:30:04 AM7/26/16
to

> On 26 Jul 2016, at 12:11, Rowland penny <rpe...@samba.org> wrote:
>
> You only really need a backup script if you only have one DC, the best way to backup your AD, add another DC.

In general that's fine if all you care about is being able to recreate a failed DC (after hardware failure or bad system update). It's no use in protecting you against user/sysadmin error where you make large, but unwanted changes to your directory (like accidentally deleting 200 users) and you want to reset it to the previous day's state.

If your second DC is offsite it might form part of your disaster recovery plan.


Sent from my iPhone

--
Kevin Davidson
Apple Certified System Administrator
Technical Director

t 01506 668674
m 07813 149620
w www.indigospring.co.uk

indigospring (Scotland) Ltd
Registered in Scotland No. SC398572
Registered office: 103 Oldwood Place, Livingston EH54 6US

Follow us on Twitter - twitter.com/indigospringIT
Members of the Apple Consultants Network - consultants.apple.com/uk

http://www.indigospring.co.uk/terms-and-conditions

L.P.H. van Belle

unread,
Jul 26, 2016, 10:50:03 AM7/26/16
to
Hai Kevin,

I to have more dc's but same as what your saying..
> In general that's fine if all you care about is being able to recreate a
> failed DC (after hardware failure or bad system update). It's no use in
> protecting you against user/sysadmin error where you make large, but
> unwanted changes to your directory (like accidentally deleting 200 users)
> and you want to reset it to the previous day's state.

For that, check :
https://github.com/thctlo/samba4

and run it in cron as much u want.

Result is like what you want, im ok with 5 backups a day.
(next to the normal backups)

>ls
samba-2016-07-18-0.tar.bz2
samba-2016-07-18-1.tar.bz2
samba-2016-07-18-2.tar.bz2
samba-2016-07-18-3.tar.bz2
samba-2016-07-18-4.tar.bz2

samba-2016-07-19-0.tar.bz2
samba-2016-07-19-1.tar.bz2
samba-2016-07-19-2.tar.bz2
samba-2016-07-19-3.tar.bz2
samba-2016-07-19-4.tar.bz2


Greetz,

Louis

Jules Houantonon

unread,
Jul 26, 2016, 11:10:02 AM7/26/16
to
Hi all,

as for samba sernet installation, the etc direction is located in to /etc
and the private in to /var/lib/samba, as the sysvol to /var/lib/samba also,

i adjust the parameter FROMWHERE=/usr/local/samba to :

FROMWHERE=/etc/samba
FROMWHERE=/var/lib/samba/private
FROMWHERE=/usr/local/samba/sysvol
WHERE=/usr/local/backups

When I run the script , i receive a tar error that said :

tar refuse to create an empty file
Error while archiving /usr/local/backups/samba4_private.2016_7_26.tar.bz2
-status=2

I though /usr/local/backups is the destination for backup files that will
be created.
For me, It seems that the script is looking for files in /usr/local/backups
and as it is a empty directory, it is rejected.

Thank you for your time and helping

Regards
--
Jules HOUANTONON
*Phone* : (00229) 97578914
*Email *: jules...@gmail.com
*Skype* : houantonon
*linkedin* : www.linkedin.com/in/jhouantonon/en

L.P.H. van Belle

unread,
Jul 26, 2016, 11:20:02 AM7/26/16
to
Get the script from github..

https://github.com/thctlo/samba4/tree/master/backup-script

 

and only change these 2.

 

This one is generated by the script, it speeds up the cron job.

SCRIPT_COMMANDS_FILE="/etc/samba/backup_samba4_commands"

 

And the location of where your backups go.

STOREDIR=/home/backups/`hostname –s`

 

Run it and it works ;-) , if not i ow you.. ;-)

 

 

Greetz,

 

Louis

 

 

 


Van: Jules Houantonon [mailto:jules...@gmail.com]
Verzonden: dinsdag 26 juli 2016 17:01
Aan: L.P.H. van Belle
CC: sa...@lists.samba.org; Kevin Davidson
Onderwerp: Re: [Samba] how to backup samba ad domain


 

Phone : (00229) 97578914
Email : jules...@gmail.com
Skype : houantonon
linkedin : www.linkedin.com/in/jhouantonon/en

Rowland penny

unread,
Jul 26, 2016, 11:20:02 AM7/26/16
to
On 26/07/16 16:01, Jules Houantonon wrote:
> Hi all,
>
> as for samba sernet installation, the etc direction is located in to /etc
> and the private in to /var/lib/samba, as the sysvol to /var/lib/samba also,
>
> i adjust the parameter FROMWHERE=/usr/local/samba to :
>
> FROMWHERE=/etc/samba
> FROMWHERE=/var/lib/samba/private
> FROMWHERE=/usr/local/samba/sysvol
> WHERE=/usr/local/backups

Which script are you using ?
If it is the standard Samba script, I would think you can only specify
'FROMWHERE' once.

Rowland

> When I run the script , i receive a tar error that said :
>
> tar refuse to create an empty file
> Error while archiving /usr/local/backups/samba4_private.2016_7_26.tar.bz2
> -status=2
>
> I though /usr/local/backups is the destination for backup files that will
> be created.
> For me, It seems that the script is looking for files in /usr/local/backups
> and as it is a empty directory, it is rejected.
>
> Thank you for your time and helping
>
> Regards
>
>
>
>


Anderson Hoffmann do Carmo

unread,
Jul 26, 2016, 12:40:03 PM7/26/16
to
I have one DC in Samba 4.3.9-Ubuntu Server
I set the backup script and it is working properly!
The restore test it is OK for me!
I scheduled via CRON and the backup takes one minute only to run


*#!/bin/bash*
*####################################*
*#*
*# Samba_AD backup script*
*#*
*####################################*

*# Stop Samba*
*/etc/init.d/samba stop*

*# What to backup*
*backup_files="/etc/samba /var/lib/samba"*

*# Where to backup to*
*dest="/BACKUP"*

*# Create archive filename*
*day=$(date +%Y_%m_%d_%H%M)*
*hostname=$(hostname -s)*
*archive_file="$hostname-$day.tgz"*

*# Backup the files using tar*
*tar --acls --xattrs -czf $dest/$archive_file $backup_files*

*# Start Samba*
*/etc/init.d/samba start*




Anderson Hoffmann do Carmo
MCP | MTA | MCDST | MCTS | MCSA | MS | MOS |
ITIL-F | ISFS | CLOUDF | CI-SCS | VCA-DCV |

Jules Houantonon

unread,
Jul 26, 2016, 6:00:03 PM7/26/16
to
Dear Rowland,

the result is the same with only one
FROMWHERE=/etc/samba

Thank you
--
Jules HOUANTONON
*Phone* : (00229) 97578914
*Email *: jules...@gmail.com
*Skype* : houantonon
*linkedin* : www.linkedin.com/in/jhouantonon/en

Jules Houantonon

unread,
Jul 26, 2016, 6:10:03 PM7/26/16
to
My friend,
you ow me a lot then. :D

I receive an error on the line

179 ${CMD_AWK} -F '.' '{print $2}') if [ -n "${TARVERSION}" ] && [ "
${TARVERSION}" -ge "27" ]; then

It is about Incorrect syntaxt. A syntax where not expected before the then.

I am using Centos 7.2 and samba-sernet 4.2

Thank you again



On Tue, Jul 26, 2016 at 4:11 PM, L.P.H. van Belle <be...@bazuin.nl> wrote:

> Get the script from github..
>
> https://github.com/thctlo/samba4/tree/master/backup-script
>
>
>
> and only change these 2.
>
>
>
> This one is generated by the script, it speeds up the cron job.
>
> SCRIPT_COMMANDS_FILE="/etc/samba/backup_samba4_commands"
>
>
>
> And the location of where your backups go.
>
> STOREDIR=/home/backups/`hostname –s`
>
>
>
> Run it and it works ;-) , if not i ow you.. ;-)
>
>
>
>
>
> Greetz,
>
>
>
> Louis
>
>
>
>
>
>
> ------------------------------
>
> *Van:* Jules Houantonon [mailto:jules...@gmail.com]
> *Verzonden:* dinsdag 26 juli 2016 17:01
> *Aan:* L.P.H. van Belle
> *CC:* sa...@lists.samba.org; Kevin Davidson
> *Onderwerp:* Re: [Samba] how to backup samba ad domain
> *Phone* : (00229) 97578914
> *Email *: jules...@gmail.com
> *Skype* : houantonon
> *linkedin* : www.linkedin.com/in/jhouantonon/en
>



--
Jules HOUANTONON
*Phone* : (00229) 97578914
*Email *: jules...@gmail.com
*Skype* : houantonon
*linkedin* : www.linkedin.com/in/jhouantonon/en

Jules Houantonon

unread,
Jul 26, 2016, 6:10:03 PM7/26/16
to
Anderson,

your script works, it backup etc and the content of /var/lib.

I just needed to ajust the samba service script to mine.

Thank you for your time also.

Regards

Jules Houantonon

unread,
Jul 26, 2016, 6:10:03 PM7/26/16
to
Dear van Belle,

It will be nice to know why it doesn't work...:)

On Tue, Jul 26, 2016 at 10:59 PM, Jules Houantonon <jules...@gmail.com>
wrote:

Rowland penny

unread,
Jul 27, 2016, 3:40:04 AM7/27/16
to
On 26/07/16 22:59, Jules Houantonon wrote:
> My friend,
> you ow me a lot then. :D
>
> I receive an error on the line
>
> 179 ${CMD_AWK} -F '.' '{print $2}') if [ -n "${TARVERSION}" ] && [ "
> ${TARVERSION}" -ge "27" ]; then
>
> It is about Incorrect syntaxt. A syntax where not expected before the then.
>
> I am using Centos 7.2 and samba-sernet 4.2
>
> Thank you again
>
>
>
>

Hmm, something wrong here, line 179 should be:

# Test if GNU tar is installed and is the required version or newer

Followed by:

TARVERSION=$(${CMD_TAR} --version | ${CMD_GREP} 'GNU tar' | ${CMD_AWK}
'{print $NF}' | \
${CMD_AWK} -F '.' '{print $2}')
if [ -n "${TARVERSION}" ] && [ "${TARVERSION}" -ge "27" ]; then
TARARGS="--acls --xattrs -cjf"
else
TARARGS="-cjf"
fi

And I know this works (on debian) because I wrote it!

It is supposed to check that the version of 'tar' installed is 'GNU tar'
and the minor version is '27' or greater, if so, backup acls & xattrs.

Rowland

L.P.H. van Belle

unread,
Jul 27, 2016, 4:10:03 AM7/27/16
to
Ai... :-(( i ow lots of people now.. oeps.. .. but thanks anyone for reporting..

Some enters moved while uploaded to github, dont know how/why.

I've corrected the script and added some extra info on the page to make things more clear.

So i would say try again.
https://github.com/thctlo/samba4/tree/master/backup-script


Greetz,

Louis

> -----Oorspronkelijk bericht-----
> Van: samba [mailto:samba-...@lists.samba.org] Namens Rowland penny
> Verzonden: woensdag 27 juli 2016 9:26
> Aan: sa...@lists.samba.org
> Onderwerp: Re: [Samba] how to backup samba ad domain
0 new messages