[Samba] R­­e: R­e: D­­C2 d­enie­s a­c­­cess­­ whe­­­n sa­­vin­g

Rowland Penny rowlandpenny at googlemail.com
Sun Nov 2 09:00:13 MST 2014


On 02/11/14 15:29, ?icro MEGAS wrote:
> Indeed, it deleted these two mentioned directories, it also tried to delete the directory
> {5F5181D6-325D-4566-8B2E-0292E9F4995B} but it wasn't able to do so.
>
> I played around a bit and actually in my opinion rsync+unison is *not* behaving correctly as one would expect. For example: I am creating a new file or directory on dc2:/var/lib/samba/sysvol/mydom.example.com called "test"
>
> After I run the rsync+unison command on DC1, this file or directory called "test" gets deleted on DC2. That's not what I would expect. What I expected is that this file/directory would be copied from DC2 to DC1. The setup works only in one direction at the moment, that mean when I create something on DC1 it is successfully synced to DC2 but _not vice-versa_ :(
>
> So in my opinion there is a misconfigured rsync+unison. How do we set this thing up so both directions work?
>
> Mirco
You would seem to be correct, I rsync'd /var/lib/samba/sysvol to 
/var/test/samba and I have been testing with the later dir. I run the 
line from the script (modified for change of path) and my test sysvol 
was replicated to the second DC, so far so good.

root at dc02:~# cd /var/test/samba//sysvol/example.com
root at dc02:/var/test/samba/sysvol/example.com# ls -la
total 32
drwxrwx---+ 4 root 3000000 4096 Aug 12 10:41 .
drwxrwx---+ 3 root 3000000 4096 Aug 12 10:40 ..
drwxrwx---+ 4 root 3000000 4096 Aug 12 10:41 Policies
drwxrwx---+ 2 root 3000000 4096 Aug 12 10:40 scripts

I then created a new directory on the second DC dc02

root at dc02:/var/test/samba/sysvol/example.com# mkdir Test
root at dc02:/var/test/samba/sysvol/example.com# chown root:3000000 Test

root at dc02:/var/test/samba/sysvol/example.com# ls -la
total 40
drwxrwx---+ 5 root 3000000 4096 Nov  2 15:38 .
drwxrwx---+ 3 root 3000000 4096 Aug 12 10:40 ..
drwxrwx---+ 4 root 3000000 4096 Aug 12 10:41 Policies
drwxrwx---+ 2 root 3000000 4096 Aug 12 10:40 scripts
drwxrwx---+ 2 root 3000000 4096 Nov  2 15:38 Test

I then ran the line from the script again on dc01

root at dc01:~# rsync -XAavz --delete-after -f"+ */" -f"- *" 
/var/test/samba/sysvol root at DC02:/var/test/samba && /usr/bin/unison
building file list ... done
sysvol/example.com/
deleting sysvol/example.com/Test/

sent 973 bytes  received 15 bytes  658.67 bytes/sec
total size is 0  speedup is 0.00
Contacting server...
Connected [//dc01//var/test/samba -> //dc02//var/test/samba]
Looking for changes
   Waiting for changes from server
Reconciling changes
Nothing to do: replicas have not changed since last sync.

If I now check if the new directory is still there:

root at dc02:/var/test/samba/sysvol/example.com# ls -la
total 32
drwxrwx---+ 4 root 3000000 4096 Aug 12 10:41 .
drwxrwx---+ 3 root 3000000 4096 Aug 12 10:40 ..
drwxrwx---+ 4 root 3000000 4096 Aug 12 10:41 Policies
drwxrwx---+ 2 root 3000000 4096 Aug 12 10:40 scripts

It has been removed and I think I understand why, rsync is removing it:

building file list ... done
sysvol/example.com/
deleting sysvol/example.com/Test/

So how do we stop rsync removing anything that is not on the first DC ????

Rowland



More information about the samba mailing list