I have two machines, one Debian, one Ubuntu, both on ext4 with extended file attributes enabled in fstab. getfattr and setfattr are installed and work perfectly on both machines locally. However, unison (version 2.40.102) doesn't sync extended file attributes by default.

I googled around and found this blog post with profile settings that are supposed to enable extended attribute sync. So, I changed my profile, and now it looks something like this:

root=ssh://[email protected]//path/to/dir2
copyprog = rsync -aX --rsh='ssh -p 22' --inplace --compress
copyprogrest = rsync -aX --rsh='ssh -p 22' --partial --inplace --compress
copyquoterem = true
copymax = 1

This profile syncs extended attributes for new files, but when I change extended attributes on a file that has already been synced and execute unison I get:

Nothing to do: replicas have not changed since last sync.

Everything else syncs perfectly, but unison is unaware of the changes in extended attributes. I also tried disabling fastcheck, hoping it would make it check the files in more detail; didn't work. I tried rsync'ing in one direction and it worked perfectly. But I need bi-directional syncing so I'm stuck with unison.

I have looked through the official manual but it only mentions extended file attributes in passing. So my question is this: can this be done with unison? Am I missing something simple here? Alternatively, are there other open source tools that can achieve this? (I'm aware of bsync and bitpocket, but in my preliminary tests they also fail to notice extended file attribute changes).

  • 2
    Unison doesn't support extended attributes at all (it's listed under “Showstoppers” in BUGS.txt). You'd have to either add this feature or find a hack similar to copyprog + copythreshold=0, but there doesn't appear to be a similar hack for change detection. Commented Sep 14, 2016 at 2:07
  • 1
    @Gilles BUGS.txt says that file attributes are not supported on OS X and Windows. I didn't know it was also true of Linux. Commented Sep 14, 2016 at 9:44
  • I guess the sentence was written before their use became widespread on Linux. Commented Sep 14, 2016 at 11:56

2 Answers 2


In case anyone runs into the same issue as I did in the future - unison doesn't work with extended file attributes. One way to go around it is the copyprog + copythreshold=0 hack (see the profile in the original question), but this doesn't solve the problem of unison not noticing changes in xattr's. As I mentioned in one of the comments, even changing the modification time of the file won't make unison sync modified xattr's. Not only that, but it will even erase them the next time that file has its content changed.

The only way I could get bi-directional syncing with extended file attributes to work is to use bsync, change it by adding -X flag to rsync arguments AND change modification time of the file.

This is far from the ideal solution: changing modification time of the file, no Windows support, Python 3 dependency, last commit was last year etc, but that's the only software I found that does the job.


This is probably what you already saw in the manual, but in the changes since 2.27 it says

Unison can sometimes fail to transfer a file, giving the unhelpful message "Destination updated during synchronization" even though the file has not been changed. This can be caused by programs that change ... the file's extended attributes without changing its modification time. It's not clear what is the best fix for this – it is not Unison's fault, but it makes Unison's behavior puzzling – ...

So it looks like Unison primarily looks at the modification time of a file over anything else. The workaround I would try would be to update the modification time of a file right after the extended attributes are changed, which would cause Unison to notice a change and sync the file. But whether or not this is feasible depends on how you are changing the extended attributes.

I think that could could use something in inotifytools to detect changes to a files extended attributes. You could write a script that uses inotifytoos to watch all the files that you wanted Unison to sync and then touch the file anytime a change is detected.

  • Unfortunately, that doesn't work either. If I create a new file, do a setfattr and then sync, xattr's get synced. If I make a chage to xattr's and sync - "replicas have not changed"; if I make a change to xattr's and touch the file and then sync, again - "replicas have not changed"; if I make changes to content of the file that has already had its xattr's synced and then sync, unison syncs the content and also DELETES the xattr's. Very strange behavior. Commented Sep 14, 2016 at 22:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .