[Samba] File attributes issue

Peter Milesson
Thu, 03 Oct 2024 17:52:53 -0000

On 03.10.2024 17:48, Anders ?stling via samba wrote:
> HiWe have two Windows servers (one active, one standby) that we keep in
sync by using ROBOCOPY to do a differential copy every night. The options make
sure that only new or altered files are transferred, and deleted ?master? files
also is deleted on the standby server.
>
> Now I want to relocate a couple of shares from the active server to a Samba
4.20 server. The shares are up and working as they should, including all ACL?s
and security information. The issue is that every file is copied every night and
not just the changed/created/deleted ones as in the Windows->Windows case. I
guess it depends on that the archive flag is not properly set on the Samba side,
but that is only my uneducated guess. How do I verify this?
>
> The Robocopy command and switches are as follows
>
> NET USE X: \\HP-DOCSRV\DOKUMENT
> ROBOCOPY D:\DOKUMENT X:\ /NFL /NDL /MIR /NP /UNILOG+:D:\DOKUMENT.LOG
/COPY:DATSO /FFT /R:5
> NET USE X: /DEL /Y
>
> The log from the Win->Win run shows 95 directories and 1243 files copied
>                 Total    Copied   Skipped  Mismatch    FAILED    Extras
>      Dirs :      5621        95      5526         0         0         0
>     Files :     54888      1243     53645         0         0         7
>     Bytes :  20.645 g  499.86 m  20.157 g         0         0   20.29 m
>     Times :   0:02:23   0:01:29                       0:00:00   0:00:53
>
> The log from the Win->Samba run, directly following the Win->Win sync
shows 104 directories and 52000 files copied. In my world they should be
identical.
>                 Total    Copied   Skipped  Mismatch    FAILED    Extras
>      Dirs :      5621       104      5517         0         0         6
>     Files :     54888     52033      2855         0         0        19
>     Bytes :  20.645 g  19.767 g  899.69 m         0         0   21.91 m
>     Times :   0:10:00   0:07:29                       0:00:00   0:02:30
>
> The Samba settings are
>
> [global]
> bind interfaces only = Yes
> client min protocol = SMB2
> dedicated keytab file = /etc/krb5.keytab
> interfaces = lo enp1s0
> kerberos method = secrets and keytab
> log file = /var/log/samba/%m.log
> min domain uid = 0
> realm = XXXXXXXX
> security = ADS
> server role = member server
> username map = /etc/samba/user.map
> winbind enum groups = Yes
> winbind enum users = Yes
> winbind refresh tickets = Yes
> workgroup = HPLTS
> idmap config hplts : range = 10000-999999
> idmap config hplts : backend = rid
> idmap config * : range = 3000-7999
> acl_xattr:ignore system acls = yes
> idmap config * : backend = tdb
> mangled names = no
> map acl inherit = Yes
> vfs objects = acl_xattr
>
>
> [dokument]
> path = /data/DOKUMENT
> read only = No
>
Hi Anders,

Try to set those parameters on the share:

 ??????? acl_xattr:ignore system acls = yes
 ??????? acl_xattr:default acl style = windows

and remove acl xattr:ignore system acls = yes from the global parameters.

With those two parameters on the share, the Samba box behaves more or
less identically to a Windows server.

I tried it out with the following command line:

robocopy c:\temp\unpack p:\slask\unpack /nfl /ndl /mir /np
/unilog+:c:\temp\trans.log /copy:datso /r:5

I left out the /FFT, as IMHO, you should leave the interpretation of
times to the respective systems.

It seems the files in the root are always copied, but folders and files
in sub folders are not, if equal. If files in sub folders are removed,
that is also reflected in the log under Extra, as it should be.

I also tried without the /copy:datso parameter, and that means
implicitly /copy:dat. In that case, the files in the root are not
copied, if they are equal. But then you lose the ownership information,
which probably is not what you want.

With a bit of reorganization, having a minimum of files in the root of
the copy, the rest should work more or less like under Windows.

It is a bit confusing, though, as one should expect that equal files in
the root should not be copied.

HTH.

Best regards,

Peter