Improving LUKS performance on SSD

My PureOS 10~devel operating system runs from a 64GB USB stick encrypted using LUKS but every operation that requires reading/writing to/from the usb stick takes too long.

In this link I found a way to improve the performance of the encrypted SSD with LUKS (Linux Unified Key Setup). Since there is not much difference between a USB stick and a Solid State Disk SSD, I applied it to my USB stick and I am happy with the performance improvement.

Just add two commands to the file /etc/crypttab

no-read-workqueue and/or no-write-workqueue

In the last line of my /etc/crypttab file it looks something like this:

luks-123abcdef-etc UUID=123abcdef-etc none luks

Well, I added the two options to it so it looks like this:

luks-123abcdef-etc UUID=123abcdef-etc none luks no-read-workqueue,no-write-workqueue

First I secured a backup to reverse the process.

sudo cp /etc/crypttab /etc/crypttab_bak

now I edited the /etc/crypttab file and made the above changes.

Additional reading:

Disable work-queue for increased SSD performance
LUKS unaswered questions


Note: After several attemps and many hours trying to setup a new usb stick with PureOS, Today I had to use the same version I first installed and use on my Lenovo U430 Touch. pureos-10evel-gnome-live-20220222_amd64.iso which is the only can boot. I tried PureOS 10.3, and PureOS 11 with no success. It seems a EFI GPT Grub / MBR Bios issue. This is why I still use Pure OS 10~devel.
Before doing this crypttab setting I had several programs stop to respond. Now I have not yet.

1 Like

I would start by measuring the read performance and the write performance (preferably without LUKS involvement) of

a) your actual make/model of USB stick, and
b) a random SSD

because in my experience

is not right (as far as performance goes).

Note though that “SSD” means several different things e.g. SATA interface to a SATA SSD and e.g. SATA interface to an NVMe (M.2) SSD and e.g. NVMe (PCIe) interface to an NVMe (M.2) SSD - and only the last will give top performance.

I don’t know what your motivation for using a USB stick is but a portable drive may be a more performant alternative. (Either option may be limited by what USB ports are available on the computer.)

2 Likes