我正在对各种cryptsetup卷进行基准测试,并且在Debian上得到了意想不到的结果。
我使用来自这次谈话的数字作为粗略的参考。其中一张幻灯片显示了各种配置的基准测试结果:

我的设置是不一样的,我在‘m中运行所有测试,所以我不期望结果完全相同,但我认为它们应该大致反映幻灯片上的内容。特别是,与未经认证的完整性模式(AES-XTS,HMAC- see 256)相比,我预计性能下降约35%,而日志完整性与非日志完整性相比,性能下降35 %。
但是下面是我的结果,类似于UbuntuServer20.04和Debian10.4:
LUKS2 container:
Capacity 1056964608 B
Read 26.5MB/s
Write 8855kB/s
LUKS2 with hmac-sha256, no journal:
Capacity 1040322560 B
Read 19.0MB/s
Write 6352kB/s
LUKS2 with hmac-sha256, journaled:
Capacity 1040322560 B
Read 18.9MB/s
Write 6311kB/s大约30%的性能下降后,启用的完整性,这是预期的。但是,日志和非日志完整性之间的差别是微不足道的。我的意思是,这比最初的基准要好得多,所以我应该很高兴,但我怎么知道日记真的在工作,如果是,我如何选择退出呢?
下面是我的cryptsetup格式命令:
cryptsetup luksFormat --type luks2 /dev/sdb --sector-size 4096
cryptsetup luksFormat --type luks2 /dev/sdb --sector-size 4096 --integrity hmac-sha256
cryptsetup luksFormat --type luks2 /dev/sdb --sector-size 4096 --integrity hmac-sha256 --integrity-no-journal基准命令:
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=/dev/mapper/sdb --bs=4k --iodepth=64 --readwrite=randrw --rwmixread=75VMs是在VirtualBox 6.1上配置的,分别为Debian和Ubuntu设置默认设置。磁盘为1GB VDI,固定大小,预填充零,主机缓冲禁用.底层的SSD使用4k扇区,因此使用--sector-size 4096。
有趣的是,基本--integrity变体和--integrity-no-journal one都创建了带有日志的中间sdb_dif映射设备,并且两个sdb设备的大小相同:
$ sudo integritysetup status /dev/mapper/sdb_dif
/dev/mapper/sdb_dif is active and is in use.
type: INTEGRITY
tag size: 32
integrity: (none)
device: /dev/sdb
sector size: 4096 bytes
interleave sectors: 32768
size: 2031880 sectors
mode: read/write
failures: 0
journal size: 8380416 bytes
journal watermark: 50%
journal commit time: 10000 ms
$ sudo blockdev --getsize64 /dev/mapper/sdb
1040322560发布于 2020-12-31 13:07:27
答复摘要:
cryptsetup format 忽略 --integrity-no-journal标志。
相反,您的选择是:
open中,始终提供--integrity-no-journal。--persistent --integrity-no-journal来持久化--integrity-no-journal设置。那么,未来的open将不需要旗子。此选项仅适用于cryptsetup,而不适用于使用直接integritysetup的情况。open编辑时,发出一个refresh --persistent --integrity-no-journal。此选项仅适用于cryptsetup,而不适用于使用直接integritysetup的情况。旧案文:
你把--integrity-no-journal标志提供给integritysetup open了吗?看起来,当您格式化时,dm-integrity会在超级块中保存日志的而不是。
我用integritysetup format /dev/sdb1 --no-wipe格式化了USB2.0闪盘分区。
然后我用integritysetup open /dev/sdb1 int-sdb1打开它,然后做了sync; echo 1 > /proc/sys/vm/drop_caches; dd count=16384 bs=4096 if=/dev/zero of=/dev/mapper/int-sdb1。这一直给了我2.1Mb/s到2.4Mb/s之间的结果。
我关闭了它,然后用integritysetup open /dev/sdb1 int-sdb1 --integrity-no-journal重新打开它,并发出相同的dd命令。这一次它给了我从4.0兆/S到7.0Mb/s,这是一个显著的进步。巨大的差异可能是由于闪存转换层;它是一个糟糕的丢弃便宜的磁盘。
我又用integritysetup format /dev/sdb1 --no-wipe --integrity-no-journal重复了一遍。同样重要的是,您是否将--integrity-no-journal交给了open命令,而不是format命令。
因此,这可能是integritysetup的不明确之处。如果您将--integrity-no=journal交给format命令。
https://unix.stackexchange.com/questions/591540
复制相似问题