[Suggestion needed] High memory usage when opening a LUKS2 partition
I was trying to open a 7.2TB encrypted ext4 partition on my Raspberry Pi (1G memory, 8G swap, using cryptsetup 2.0.2
) but got:
Mar 27 00:26:25 Pi3BP kernel: Out of memory: Kill process 738 (cryptsetup) score 93 or sacrifice child
Mar 27 00:26:25 Pi3BP kernel: Killed process 738 (cryptsetup) total-vm:1056100kB, anon-rss:888844kB, file-rss:5704kB, shmem-rss:0kB
Mar 27 00:26:25 Pi3BP kernel: oom_reaper: reaped process 738 (cryptsetup), now anon-rss:888940kB, file-rss:5692kB, shmem-rss:0kB
The partition was created via
cryptsetup --cipher aes-xts-plain64 --key-size 256 --hash sha256 luksFormat --type luks2 /dev/sdb1
Having no idea why cryptsetup open
was consuming such a large amount of memory, I spent hours googling the issue but got no clue at the end. But since most of the successful examples I found were quite old and apparently they were using LUKS1, I tried re-formatting the partition with --type luks1
and this time it just got mounted on Raspberry Pi without any error.
May I know:
- Are there any workarounds to this issue?
- What factors influence the memory usage?
This is pretty much the first time for me to try out disk encryption and I am still absolutely a n00b. It would be greatly appreciated if you could provide me some suggestions. Thanks!