Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently I tried to copy 200GB to a 1TB external / USB2 / encrypted disk and it took 36 hours. The same copy when the disk was not encrypted took no longer than 1 hour.

I am using dm-crypt (LUKS) with the default cipher and ext4 filesystem. I would like to know what I can do to optimize the performance.

share|improve this question
I'm curious, would using a file system with fast transparent compression (such as BTRFS + LZO) help? – Petr Pudlák Mar 23 '13 at 9:40

Get a processor that supports AES-NI, if you don't have one already.

Lacking that, you might try switching to a different cipher, such as Blowfish, but I don't know if that'll help. Blowfish is faster for encrypting cipher blocks, but I've read that AES is very fast to initialize, and since dm-crypt encrypts each disk block separately (so you don't have to decrypt the whole disk from the beginning to access data in the middle), the need to reinitialize the cipher for every disk block may give AES the advantage. I haven't done a performance comparison, though.

share|improve this answer

Recent Intel and AMD processors have a cryptographic accelerator called AES-NI. This can provide a visible speedup when encrypting a large volume of data. It's up to you to decide whether a speedup in encryption is worth buying a more recent processor.

The default cipher is somewhat conservative. When creating the encrypted volume, pick AES as the cipher (that's usually the default) and 128 as the key size (instead of 256). Using a 128-bit key can provide a noticeable speedup with no practical reduction in security. In particular, if your passphrase has less than 128 bits of entropy (that's 20 random printable characters, and far more than that if the passphrase is not random), increasing the key size beyond 128 provides no added security. Note that you need to decide on a key size when creating the volume, this isn't something you can change afterwards.

The relative performance of filesystems is the same whether the disk is encrypted or not.

share|improve this answer
First off: Gilles, I have the utmost respect you and all the time you spend answering peoples' questions. That said, I think you need to qualify your comments here about 128 vs 256bit with a note about it being personal opinion. (Or else provide a source.) – rsaw Aug 4 '12 at 0:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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