Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

I have a Laptop (Asus Zenbook UX31A) with 124GB SSD. I installed Ubuntu on a encrypted partition and started facing moments of temporary or permanent unresponsiveness. I suspected I/O and did some benchmarks.

Disk writes seem to be terribly slow:

➜  ~  dd if=/dev/zero of=tempfile bs=1M count=200 conv=fdatasync,notrunc
200+0 records in
200+0 records out
209715200 bytes (210 MB) copied, 8.2222 s, 25.5 MB/s

Reads look ok

➜  ~  echo 3 > /proc/sys/vm/drop_caches
➜  ~  dd if=tempfile of=/dev/null bs=1M count=200
200+0 records in
200+0 records out
209715200 bytes (210 MB) copied, 0.9317 s, 225 MB/s

I was checking htop and iotop while performing writes and noticed no significant increase in CPU load. iotop's "Actual DISK WRITE" showed ~200MB/s for a short period of time and immediately dropped back to 0 (write dd was running for few more seconds after that).

I have Intel i7-3517U CPU, which supports AES-NI, which is also enabled in BIOS. AES-NI kernel modules seem to be enabled:

➜  ~  lsmod | grep aes
aesni_intel            55624  376 
aes_x86_64             17131  1 aesni_intel
lrw                    13286  5 serpent_sse2_x86_64,aesni_intel,serpent_avx_x86_64,twofish_avx_x86_64,twofish_x86_64_3way
glue_helper            13990  5 serpent_sse2_x86_64,aesni_intel,serpent_avx_x86_64,twofish_avx_x86_64,twofish_x86_64_3way
ablk_helper            13597  4 serpent_sse2_x86_64,aesni_intel,serpent_avx_x86_64,twofish_avx_x86_64
cryptd                 20359  190 ghash_clmulni_intel,aesni_intel,ablk_helper

cryptsetup benchmarks also looks ok:

➜  ~  ./workspace/cryptsetup-1.6.1/src/cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1       433295 iterations per second
PBKDF2-sha256     254508 iterations per second
PBKDF2-sha512     154021 iterations per second
PBKDF2-ripemd160  347671 iterations per second
PBKDF2-whirlpool  184608 iterations per second
#  Algorithm | Key |  Encryption |  Decryption
     aes-cbc   128b   516.9 MiB/s  1894.4 MiB/s
 serpent-cbc   128b    72.8 MiB/s   251.0 MiB/s
 twofish-cbc   128b   156.1 MiB/s   284.7 MiB/s
     aes-cbc   256b   368.2 MiB/s  1379.8 MiB/s
 serpent-cbc   256b    75.3 MiB/s   243.3 MiB/s
 twofish-cbc   256b   157.7 MiB/s   292.7 MiB/s
     aes-xts   256b  2376.0 MiB/s  3503.0 MiB/s
 serpent-xts   256b   307.7 MiB/s   264.2 MiB/s
 twofish-xts   256b   340.7 MiB/s   345.7 MiB/s
     aes-xts   512b  4548.0 MiB/s  4527.0 MiB/s
 serpent-xts   512b   315.1 MiB/s   265.0 MiB/s
 twofish-xts   512b   327.7 MiB/s   328.7 MiB/s

Cryptsetup status:

➜  ~  sudo cryptsetup status sda3_crypt
/dev/mapper/sda3_crypt is active and is in use.
  type:    LUKS1
  cipher:  aes-xts-plain64
  keysize: 512 bits
  device:  /dev/sda3
  offset:  4096 sectors
  size:    241291264 sectors
  mode:    read/write

SSD is SanDisk U100:

➜  ~  sudo lshw
      physical id: 1
      logical name: scsi0
      capabilities: emulated
         description: ATA Disk
         product: SanDisk SSD U100
         physical id: 0.0.0
         bus info: scsi@0:0.0.0
         logical name: /dev/sda
         version: 10.5
         serial: 122300414449
         size: 115GiB (124GB)
         capabilities: gpt-1.00 partitioned partitioned:gpt
         configuration: ansiversion=5 guid=462c7bc0-c895-4486-a0de-9911664bdbf8 sectorsize=512
            description: Windows FAT volume
            vendor: mkdosfs
            physical id: 1
            bus info: scsi@0:0.0.0,1
            logical name: /dev/sda1
            logical name: /boot/efi
            version: FAT32
            serial: f767-aca8
            size: 189MiB
            capacity: 189MiB
            capabilities: boot fat initialized
            configuration: FATs=2 filesystem=fat mount.fstype=vfat mount.options=rw,noatime,nodiratime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro state=mounted
            description: data partition
            vendor: Linux
            physical id: 2
            bus info: scsi@0:0.0.0,2
            logical name: /dev/sda2
            logical name: /boot
            version: 1.0
            serial: 196c3925-113a-465a-b73e-b3506bf86401
            size: 244MiB
            capabilities: ext2 initialized
            configuration: filesystem=ext2 modified=2014-01-28 00:30:04 mount.fstype=ext2 mount.options=rw,noatime,nodiratime,errors=continue state=mounted
            description: data partition
            vendor: Windows
            physical id: 3
            bus info: scsi@0:0.0.0,3
            logical name: /dev/sda3
            serial: 4e2be2b7-d729-4e1f-912a-319533fa4e4b
            size: 115GiB
            capacity: 115GiB
            width: 512 bits
            capabilities: encrypted luks initialized
            configuration: bits=512 cipher=aes filesystem=luks hash=sha1 mode=xts-plain64 version=1

Thank you!

share|improve this question

It turned out that the problem was not related to encryption at all. I needed to use fstrim command on my SSD partitions and add discard option to my SSD partirion mounts. Now it works as expected.

share|improve this answer

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.