Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSD TRIM not working on encrypted root partition #674

Open
o-alquimista opened this issue Dec 8, 2022 · 1 comment
Open

SSD TRIM not working on encrypted root partition #674

o-alquimista opened this issue Dec 8, 2022 · 1 comment

Comments

@o-alquimista
Copy link

o-alquimista commented Dec 8, 2022

What Happened?

After performing an encrypted install of elementary on an SSD, the TRIM command will not work on the root partition because it's missing a configuration option.

Steps to Reproduce

  1. Install elementary, selecting the default encrypted setup the installer offers.
  2. Boot the newly installed system and run sudo fstrim -av

Expected Behavior

Expected output of sudo fstrim -av:

/boot/efi: 251,7 MiB (263872512 bytes) trimmed on /dev/nvme0n1p1
/boot: 11,2 MiB (11714560 bytes) trimmed on /dev/nvme0n1p2
/: 3,3 GiB (3517906944 bytes) trimmed on /dev/mapper/data-root

Actual output of sudo fstrim -av:

/boot/efi: 251,7 MiB (263872512 bytes) trimmed on /dev/nvme0n1p1
/boot: 11,2 MiB (11714560 bytes) trimmed on /dev/nvme0n1p2

Expected contents of /etc/crypttab:

cryptdata UUID=51f61b21-5e03-4446-a244-6c399769f909 none luks,discard

Actual contents of /etc/crypttab:

cryptdata UUID=51f61b21-5e03-4446-a244-6c399769f909 none luks

Currently TRIM is only working on the boot partitions. It's important to let the TRIM command pass through to the root partition too. Ubuntu and Fedora are already doing this.

To fix this:

  1. Edit /etc/crypttab and add the missing discard option to the cryptdata entry.
  2. Rebuild the initramfs sudo update-initramfs -u -k all (reference).
  3. Reboot.

OS Version

6.1 (Jólnir)

Software Version

Latest release (I have run all updates)

Log Output

No response

Hardware Info

No response

@o-alquimista o-alquimista changed the title Missing 'discard' option for encrypted device in /etc/crypttab SSD TRIM not working on encrypted root partition Dec 8, 2022
@o-alquimista
Copy link
Author

o-alquimista commented Feb 4, 2023

This is reproducible on elementary 7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant