Hey
So, i did enable periodic trim on my SSD. The /
partition (p6 here), LUKS encrypted, didn’t seem to be able to be trimmed regarding the result of
$ lsblk --discard
NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
nvme0n1 0 512B 2T 0
├─nvme0n1p1 0 512B 2T 0
├─nvme0n1p2 0 512B 2T 0
├─nvme0n1p3 0 512B 2T 0
├─nvme0n1p4 0 512B 2T 0
├─nvme0n1p5 0 512B 2T 0
└─nvme0n1p6 0 512B 2T 0
└─luks-f6540be3-39bf-401d-8c00-5603b407b4cd 0 0 0 0
So, as per the arch wiki, i added the kernel parameters :allow-discards
to the cryptdevice
option and rd.luks.options=discard
in the grub bootloader configuration.
I’m a bit confused with that part of the wiki: “for non-root filesystems, configure /etc/crypttab
to include discard
in the list of options”. As the luks partition is the /
, can i just ignore this?
Actually, without modifying /etc/crypttab
, the result of
$ lsblk --discard
NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
nvme0n1 0 512B 2T 0
├─nvme0n1p1 0 512B 2T 0
├─nvme0n1p2 0 512B 2T 0
├─nvme0n1p3 0 512B 2T 0
├─nvme0n1p4 0 512B 2T 0
├─nvme0n1p5 0 512B 2T 0
└─nvme0n1p6 0 512B 2T 0
└─luks-f6540be3-39bf-401d-8c00-5603b407b4cd 0 512B 2T 0
$ sudo dmsetup table
[sudo] Mot de passe de lmm :
luks-f6540be3-39bf-401d-8c00-5603b407b4cd: 0 750565391 crypt aes-xts-plain64 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 259:6 4096 1 allow_discards
And if i do
$ sudo fstrim --verbose --all
[sudo] Mot de passe de lmm :
/boot/efi : 67,4 MiB (70632448 octets) réduits sur /dev/nvme0n1p1
/boot : 416,4 MiB (436604928 octets) réduits sur /dev/nvme0n1p5
/ : 330,6 GiB (355009146880 octets) réduits sur /dev/mapper/luks-f6540be3-39bf-401d-8c00-5603b407b4cd
[lmm@lmm-hpebk840g7nbpc ~]$ sudo fstrim -v /
/ : 1,7 GiB (1875058688 octets) réduits
So i guess it’s good, I can safely ignore the /etc/crypttab
part?
And, last but not least, does periodic trim worth the pain on this BTRFS file system? (and adding the security “risks” regarding the encryption)
Cheers !