The*_*ame 5 encryption partitioning ssd luks 18.04
由于我在笔记本上用LUKS加密了“/”和“/home”的分区,所以我的ssd整体写入速度很低。
硬件软件
分区
没有lvm
SSD
Nr Type Size FS
1 EFI 256MB vfat
2 Boot 512MB ext4
3 / 40GB ext4 (luks)
4 /home 80GB btrfs (luks)
HDD
Nr Type Size FS
1 /data 500GB btfs (luks)
Run Code Online (Sandbox Code Playgroud)
加密
我在所有分区上使用了相同的算法
cipher: aes-xts-plain64
keysize: 512 bits
hash: sha512
Run Code Online (Sandbox Code Playgroud)
密码设置基准
aes-xts 512b 684,2 MiB/s 677,9 MiB/s
Run Code Online (Sandbox Code Playgroud)
基准
我用LUKS加密前后用dd监控读写速度
# write
dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc
# drop cache
echo 3 | sudo tee /proc/sys/vm/drop_caches
# read
dd if=tempfile of=/dev/null bs=1M count=1024
Run Code Online (Sandbox Code Playgroud)
LUKS 之前的结果是 MB/s
SSD
Write Read
343 561
HDD
Write Read
106 110
Run Code Online (Sandbox Code Playgroud)
LUKS 后的结果为 MB/s
FS Drive Write-luks Read-luks
/ ext4 ssd 50 378
/home btrfs ssd 50 543
/data btrfs hdd 109 105
Run Code Online (Sandbox Code Playgroud)
HDD上的读写速度保持不变,但现在ssd上的写入速度非常低。
我在 dd count=256 的“/boot”分区(没有 luks,ssd)上执行了相同的基准测试。
SSD in MB/s
FS Drive Write Read
/boot ext4 ssd 49 527
Run Code Online (Sandbox Code Playgroud)
结果表明,“/boot”分区的写入速度与其他加密分区一样低。
我不明白,为什么硬盘的性能保持不变,但固态硬盘的写入速度非常低,而且在未加密的分区上也是如此。
丢弃在 LUKS 上处于活动状态
dmsetup table | grep crypt
home: 0 [] crypt aes-xts-plain64 [0] 0 8:20 4096 1 allow_discards
root: 0 [] crypt aes-xts-plain64 [0] 0 8:19 4096 1 allow_discards
data: 0 [] crypt aes-xts-plain64 [0] 0 8:1 4096 1 allow_discards
Run Code Online (Sandbox Code Playgroud)
我会感谢一些想法或帮助。