All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] Properly enabling TRIM for dm-crypt on an SSD
@ 2020-12-20 11:36 Mistave
  2020-12-20 18:12 ` Martin Jørgensen
  0 siblings, 1 reply; 4+ messages in thread
From: Mistave @ 2020-12-20 11:36 UTC (permalink / raw)
  To: dm-crypt

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@saout.de
https://www.saout.de/mailman/listinfo/dm-crypt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-21 21:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-20 11:36 [dm-crypt] Properly enabling TRIM for dm-crypt on an SSD Mistave
2020-12-20 18:12 ` Martin Jørgensen
2020-12-21 16:53   ` Mistave
2020-12-21 21:45     ` Mistave

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.