Ubuntu – How does ecryptfs impact harddisk performance

defragecryptfsfilesystemperformance

I have my home directy encrypted with ecryptfs. Does ecryptfs lead to fragmentation?

I have the feeling that reading files, displaying folders and login became continuously slower and slower (although it was not noticeably slow at the beginning). The hard disk makes a lot of seek noise even if I open only a text file.
In /home/.ecryptfs I see many big archives (that probably contain the encrypted files), so I'm wondering if Linux file system online defragmentation gains anything here.

What options do I have to increase performance? Should I decide whether I maybe better do without encryption?

Best Answer

Phoronix has run a suite of tests and a couple of articles on eCryptfs performance when encrypting home directories:

My take away from those articles is that encryption (as expected) according to the benchmarks, does impact read and write performance to a degree. On small CPUs (Atom processors), and on fast hard drives (SSDs), this is perhaps more noticeable. That said, by using eCryptfs, you're only paying that performance penalty when reading/writing data to your home directory (and not the rest of the system, as you would with full-disk encryption). Furthermore, with faster processors, the amount of time spent doing that encryption/decryption often fits within the IO wait accessing the data from disk, which is usually the bottleneck.

As to your particular issue, if you're hearing a lot of "hard disk seek" noise, it sounds to me that your system is swapping data from memory to disk, and back and forth. If you've chosen to use eCryptfs, then Ubuntu will automatically encrypt your swap space (which is required to safeguard your encrypted data). However, encrypted swap is very expensive, too.

Personally, I overload my systems with lots of RAM (8GB on most of my systems), and disable swap entirely.

Related Question