3

I have a Raspberry Pi4 (4GB) with a 250GB SSD connected via USB3. The SSD has a write speed of about 70MB/s, which is very nice. The SSD is mounted via fstab and the following settings:

LABEL=DATA /media/extStorage   exfat-fuse nofail,auto,sync,gid=www-data,rw,umask=007 0 0

But I have a VeraCrypt encrypted file container which is about 95% of the SSD volume size. When I mount the container with the command

sudo -u root veracrypt /media/extStorage/data.hc /mnt/data/ --pim=230 -k "" --protect-hidden=no --fs-options "gid=www-data,umask=007"

the write speed is only about 3MB/s, which is 1/18th of the originally speed... When mounted and while writing the process "/sbin/mount.exfat-fuse /dev/sda1 ..." has a very high CPU usage: CPU usage while mounted and write operation

The command lsof for /media/extStorage shows that only VeraCrypt is accessing.

As far as I understand VeraCrypt, the CPU load should not be that high after mounting... I also tried using a much lower PIM, which was only faster when mounting.

So do I do somthing wrong when mounting the drive or the encrypted container (e.g. wrong or mising commands)? What could cause that kind of problems?

Thank you in advance for your answers.

EDIT: Just to mention: I downloaded the source code of VeraCrypt and compiled it myself on my Raspberry, if that could include an error...

I found that may the lack of a hardware AES module could be the problem... so the Raspberry have to use software AES which is CPU intense and therefore slower... I don't know how to solve this problem, because the RPi does not seem to have that module on the chip... (https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=207888&p=1568740&hilit=aes#p1568740) I never had that kind of problems before, because my Notebook and my Tablet support hardware AES. Maybe another encryption software (like dm-crypt) is more convenient?

EDIT2: This problem was solved by using EXT4 formatting instead of exfat. See my first comment under the first answer.

Florian
  • 41
  • 5

1 Answers1

3

I just have tried to write to an encrypted volume: TrueCrypt, AES encryption, the container is a partition on a USB3 drive, encrypted drive formatted as EXT4. I see a data rates between 45 and 52 MB/s (according to my file manager), with CPU load hovering around 65%: about 30% used by TrueCrypt and another 30% used by USB XHCI driver.

My TrueCrypt encryption benchmark (with 50MB RAM buffers) reports 121 MB/s encryption speed and 117 MB/s decryption speed for AES. As in your case, AES hardware support is N/A.

My advice would be that you try different encryption algorithms, e.g. Twofish. Perhaps AES encryption implemented in VeraCrypt performs poorly on RPi hardware. Or try a different encryption software.

PS. I assume that your RPi 4 is not throttled due to overheat or low power supply voltage. For instance, if I power my RPi by 4.8V instead of 5, the data rate drops from 52 MB/s to 12.

Dmitry Grigoryev
  • 28,277
  • 6
  • 54
  • 147