I am using rsync between Mac 10.13 (APFS) and Pop_OS (ext4) with a flash drive as transfer medium (FAT). My command is

rsync -av --exclude-from='exclude-files.txt' source-dir destination-dir

I am excluding the following patterns since I assumed they are only relevant to Mac:


If a Mac file has any extended attributes, they appear on the FAT flash drive and my Linux system as hidden files, eg, ._exclude-files.txt.

If I run ls -al@ on the flash drive mounted on my Mac, I do not see that ._exclude-files.txt but I do see the following xattr list:

com.apple.TextEncoding    15
com.apple.metadata._kMDItemUserTags    42
com.apple.lastuseddate#PS    16

When I mount the flash drive on my Linux laptop, I do see ._exclude-files.txt along with the actual file.

I have tried rsync dry runs with the -X option with and without --filter='-x! user.*' (although I admit to not completely understanding the concept of user namespace).

I can probably work around this problem by excluding *._*, but I would rather understand why this is happening. I am new to Linux/Ubuntu/Pop, but my goal is to make it my main OS.

UPDATE: I wondered if my problem was created by initially copying directories from my Mac to my flash drive and then to my Linux system. So I ran a test where I used rsync from a Mac directory into an empty directory on the flash drive. At first, ls -al@ on the flash drive directory mounted on my Mac showed the file without any xattr. So I deleted the contents of the original Mac directory and tried to rsync --dry-run them back again. Once again the verbose output showed ._my-file.txt even though that file had not shown any xattr.

When I tried this with -X I got rsync error: rsync: get_xattr_names(...) failed: Operation not permitted (1)

But the good news was that verbose output only showed my-file.txt being sent, not the mysterious ._my-file.txt.

I figured I could live with that and ran rsync -avX flash_drive_volume original_mac_dir. Now the original file was back in its original location, but contrary to my expectations, it once again has extended attributes.

It's as if MacOS is determined to set extended attributes one way or the other. I would not care except that I don't want to fill my Linux system with irrelevant files. Maybe I should just add *._* to my excludes and forget about this?

UPDATE 2: I found this explanation of the ._ files. Mac OS X: Apple Double Format Creates File Name With the Prefix '._'


I think I will attempt to answer my own question after some research. When I looked at ```file ._my-file.txt`` on my Linux system it returned "AppleDouble Macintosh file". So I searched "appledouble".

First, from my UPDATE 2 above:

With Mac OS X, there is a mechanism called "Apple Double" that allows the system to work with disk formats that do not have a forked file feature... Apple Double does this by converting the file into two separate files. The first new file keeps the original name and contains the data fork of the original file. The second new file has the name of the original file prefixed by a "._ " and contains the resource fork of the original file.

It seems an rsync from Mac to Linux will create these "._" files, and rsync from Linux back to Mac will send them back to the Mac unless I first delete them (e.g., find . -name *._* -delete) or exclude them.

If these ._ files end up on a Mac, there is a Mac command dot_clean:

...recursively merges all ._* files with their corresponding native files...

--The dot_clean man page.

This has been discussed on Ask Different here, here, and here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.