Open porg opened 2 years ago
I think the mapping is configurable in Samba to match rsync's behavior.
https://www.samba.org/samba/docs/current/man-html/vfs_streams_xattr.8.html
How exactly would that help?
I forgot everything meanwhile, my lengthy/detailed post is 2 years old.
By which concrete mappings could one improve the use case rsync is used both as sender on the Mac and receiver on the NAS ?
You can set the prefix to match rsync (as sender & receiver) and drop the suffix.
streams_xattr:prefix = user.
streams_xattr:store_stream_type = no
It also works for your first usage (rsync into SMB mount). However, when doing that rsync might fail (unrelated to these settings) when one xattr is a prefix of another, due to a bug in Apple SMB client implementation.
Thanks. As I do not have that use case anymore (too often) I currently don't have the time to try it out and give feedback on it. But I gladly come back here, should I need it at a later time. Thanks for having taken the time!
Use Case & User Goals
--archive --xattr
) is clever enough to only transfer the xattr. ๐ Very fast!Problem
rsync --xattr ~/path/ nas.local::Shared-rsync/path/
(sender on Mac, receiver on NAS) maps the xattr differentlycp ~/path/file.txt /Volumes/Shared/path/
file.txt
from local~/path/
to the mounted SMB share/Volumes/Shared/path/
~/path/
in a Finder window and the mounted SMB share/Volumes/Shared/path/
in another Finder window and copying withโฆEnvironment
MacBook Pro (Mid 2014)
Odroid Home Cloud 2 โ Single Board Computer (SBC) acting as a Network Attached Storage (NAS)
/etc/samba/smb.conf ๐ Click to expand
``` ini # This file is auto-generated by openmediavault (https://www.openmediavault.org) # WARNING: Do not edit this file, your changes will get lost. #======================= Global Settings ======================= [global] workgroup = WORKGROUP server string = %h server dns proxy = no log level = 2 log file = /var/log/samba/log.%m max log size = 1000 logging = syslog panic action = /usr/share/samba/panic-action %d encrypt passwords = true passdb backend = tdbsam obey pam restrictions = no unix password sync = no passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . pam password change = yes socket options = TCP_NODELAY IPTOS_LOWDELAY guest account = nobody load printers = no disable spoolss = yes printing = bsd printcap name = /dev/null unix extensions = yes wide links = no create mask = 0777 directory mask = 0777 use sendfile = yes aio read size = 16384 aio write size = 16384 time server = no wins support = no multicast dns register = no # Special configuration for Apple's Time Machine # Coming from GUI autoconfig fruit:aapl = yes # Coming from GUI autoconfig # Extra options # OMV default extra options min receivefile size = 16384 write cache size = 524288 getwd cache = yes socket options = TCP_NODELAY IPTOS_LOWDELAY # Recommendations from # https://wiki.samba.org/index.php/Configure_Samba_to_Work_Better_with_Mac_OS_X # man vfs_fruit min protocol = SMB2 ea support = yes vfs objects = fruit streams_xattr # https://support.apple.com//HT207128 # would recommended "catia fruit streams_xattr". Did not try that yet. fruit:aapl = yes # Manually by me in extra options of GUI fruit:metadata = stream fruit:posix_rename = yes fruit:veto_appledouble = no fruit:nfs_aces = no fruit:wipe_intentionally_left_blank_rfork = yes fruit:delete_empty_adfiles = yes #======================= Share Definitions ======================= [Shared] path = /srv/dev-disk-by-label-share/Shared/ guest ok = no guest only = no read only = no browseable = yes inherit acls = yes inherit permissions = no ea support = no store dos attributes = no vfs objects = # Coming from GUI autoconfig. Afraid this nullifies. printable = no create mask = 0664 force create mode = 0664 directory mask = 0775 force directory mode = 0775 hide special files = yes follow symlinks = yes hide dot files = no # These seem to be derived from the settings for the share folder by the autoconfig: valid users = "wife","me" invalid users = @"kids" read list = "wife" write list = "me" vfs objects = fruit streams_xattr # Hence manually aded by me in extra options of GUI. ```Background Info
RFC 8276 โ File System Extended Attributes in NFSv4 (December 2017)
MacOS stores the Finder tags in an xattr named
com.apple.metadata:_kMDItemUserTags
as a binary PLIST.8.txt
has the Finder Tag "โขTODO" which also has the red label color.15.txt
has the Finder Tag "Artwork" without any color. Later amended by tags "Automation" & "Billing".HEX/plaintext output of xattr com.apple.metadata:_kMDItemUserTags ๐ Click to to see the raw BPLIST value in the xattrs
``` $ xattr -l ~/mac/path/8.txt # With Finder Tag "โขTODO" & also having a red label color. com.apple.FinderInfo: 00000000 00 00 00 00 00 00 00 00 00 0C 00 00 00 00 00 00 |................| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 com.apple.metadata:_kMDItemUserTags: 00000000 62 70 6C 69 73 74 30 30 A1 01 67 20 22 00 54 00 |bplist00..g ".T.| 00000010 6F 00 64 00 6F 00 0A 00 36 08 0A 00 00 00 00 00 |o.d.o...6.......| 00000020 00 01 01 00 00 00 00 00 00 00 02 00 00 00 00 00 |................| 00000030 00 00 00 00 00 00 00 00 00 00 19 |...........| $ xattr -l ~/mac/path/15.txt # With Finder Tag "Artwork" without any color. com.apple.metadata:_kMDItemUserTags: 00000000 62 70 6C 69 73 74 30 30 A1 01 57 41 72 74 77 6F |bplist00..WArtwo| 00000010 72 6B 08 0A 00 00 00 00 00 00 01 01 00 00 00 00 |rk..............| 00000020 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000030 00 00 00 12 |....| 00000034 $ xattr -l ~/mac/path/15.txt # Meanwhile tag "Automation" was added to the end. com.apple.metadata:_kMDItemUserTags: 00000000 62 70 6C 69 73 74 30 30 A2 01 02 57 41 72 74 77 |bplist00...WArtw| 00000010 6F 72 6B 5A 41 75 74 6F 6D 61 74 69 6F 6E 08 0B |orkZAutomation..| 00000020 13 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 |................| 00000030 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 1E |.| 00000041 $ xattr -l ~/mac/path/15.txt # Meanwhile tag "Billing" was inserted at start. com.apple.metadata:_kMDItemUserTags: 00000000 62 70 6C 69 73 74 30 30 A3 01 02 03 57 42 69 6C |bplist00....WBil| 00000010 6C 69 6E 67 57 41 72 74 77 6F 72 6B 5A 41 75 74 |lingWArtworkZAut| 00000020 6F 6D 61 74 69 6F 6E 08 0C 14 1C 00 00 00 00 00 |omation.........| 00000030 00 01 01 00 00 00 00 00 00 00 04 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 27 |..........'| 0000004b ```Debian's xattr -l crashes with UnicodeDecodeError for com.apple.metadata:_kMDItemUserTags
Sadly there's a yet undetected bug in the
xattr command line tool
on my NAS "Odroid Home Cloud 2", running Open Media Vault 5, Debian based.When attempting to display xattrs in the list output mode which is hardcoded to a combined HEX/plaintext-interpretation output, values which cannot be interpreted as ASCII or UTF-8 as they are present in the proprietary
com.apple.metadata:_kMDItemUserTags
cause a crash:reportbug
and have a Terminal based mail sending infrastructure. Really nerdy 1980ies mailing list backwards compatibility.When this display bug happens the
xattr command line tool
only shows key/value pairs prior the first problematic key/value pair in encounters, and for that problematic key/value pair it does not even show the key name.com.apple.metadata:_kMDItemUserTags
working well in a mixed mode usage of the NAS sometimes accessed via rsync and sometimes via SMB.Problem in detail
Ad 2) When using
rsync <my-arguments> ~/path/ /Volumes/SMB-Mounted-Share/path/
rsync works purely locally, and the xattrs transfer with a mapping which works in practise:
In the Finder windows
~/path/
and/Volumes/SMB-Mounted-Share/path/
thefile-with-finder-tags.txt
shows the same tags in both windows immediately after sync.On the Mac, xattr of the local file:
On the NAS via SSH:
On the Mac, xattr of the SMB accessed file:
In this form rsync itself works purely locally: On a local filesystem
~/path/
and on a locally mounted remote filesystem/Volumes/SMB-Mounted-Share/path/
whose network abstraction is handled by SMB.Ad 1) When using
rsync <my-arguments> ~/path/ nas.local::Shared-rsync/path/
rsync is used both as sender on the Mac and receiver on the NAS
๐ So I would benefit from all delta transfer benefits.
๐ but the xattr mapping goes practically wrong
โน๏ธ Prior the next rsync
Then ran the rsync:
On the Mac, xattr of the local file:
On the NAS via SSH:
On the Mac, xattr of the SMB accessed file:
Followup
rsync --xattr
from Mac to Linux is wrongly implemented.