Properly enabling TRIM for dm-crypt on an SSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

I have some questions about the TRIM/discard for LUKS-encrypted SSDs.

I currently have a custom Ubuntu 20.04 LTS setup with encrypted ext4
rootfs partition (it's /dev/sda2 and /dev/sda1 is the EFI partition) on
an HDD that I'd like to migrate to an SSD. I was originally going to do
a block-for-block copy using dd, but I figured it'd be better and faster
to copy just the files from rootfs and the EFI partition rather than the
entire disk. So I'm going to setup a new LUKS volume (same parameters)
on the SSD and then sync the filesystem contents over there.

This got me thinking about optimizing the system for SSD since it was
originally installed on an HDD. While googling for information I found
out about two types of TRIM: continuous and periodic. The docs say that
the continuous mode is activated by adding a "discard" parameter to the
rootfs mount options in /etc/fstab or by activating a certain flag by
tune2fs. The periodic mode is activated by placing the fstrim utility on
a timer i.e. a weekly cron job or systemd timer. I noticed the latter is
already active on my system.

Anyway, I was wondering how this is handled when dm-crypt lies between
the SSD and the filesystem. Do I need to take any additional steps in
this case or will fstrim do its thing as is? I'm just checking because
there is so much contradicting information available online. Some people
mentioned that a "discard" parameter should be added to /etc/crypttab
entry, others claim they must be present on both files - fstab and
crypttab. Some even suggest to add an "allow-discards" parameter to the
GRUB kernel command line in /etc/default/grub file. I was also told that
the continuous TRIM is discouraged and that periodic should be used instead.

What's the correct thing to do here?

Thanks in advance.
_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
https://www.saout.de/mailman/listinfo/dm-crypt



[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux