I have a folder with a few hundred thousand small files, totalling about 14 GB of data. This is a folder in my ecryptfs encrypted home directory.
Doing a "du -sh folder" takes over 9 minutes. Doing a cp -ral to a non-encrypted location takes an hour and 15 minutes. CPU load during this time is mostly IO-bound (80% wa in top)
Doing a "du -sh encryptedfolder" only takes 15 seconds and a cp -ral to the same location takes but 80 seconds. 'encryptedfolder' is the folder in /home/.ecryptfs/myname/.Private that contains the encrypted files.
I am baffled how this performance hit happens. This folder is backuped nightly via rsync, which now takes more than two hours. Before I switched to ecryptfs, I used truecrypt and backup ran in 12 minutes.
Why is ecryptfs so abysmal slow in this scenario? The du -sh and cp -ral operations do not involve any decryption of file contents, just finding the right filename. Is there some way to speed this up?
P.S.: This runs on Ubuntu 11.04