rsync giving "file name too long" errors with ecryptfs

Solution 1:

As mentioned over on Unix StackExchange, the maximum filename in an ext4 system is 255 characters. Since you have encrypted filenames turned on with your destination eCryptfs filesystem, and since eCryptfs is just a layered filesystem on top of your ext4 filesystem, all file name path elements, once encrypted, must be less than 255 characters. Similarly, the full path of any of your encrypted file names must be less than 4096 characters.

It seems that at least one of your source files has a path and/or name which violates this limit.

A couple of options come to mind to allow rsync to be able to complete its work:

  1. Find all files in your source filesystem that have path elements longer than 143 characters (or total paths greater than, perhaps, two or three thousand characters) and rename them to have less than that. (143 pulled from the previously referenced Unix StackExchange post due to encrypted filename padding). This may or may not be possible, depending on if the files in question can be renamed which preserving the functionality that you need on your system.
  2. Turn off filename encryption on your eCryptfs system. Of course, you'll lose the anonymity of your files names, but this may be acceptable to you.