-
Notifications
You must be signed in to change notification settings - Fork 97
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
Support TRIM in LUKS partitions mounted by Kairos #2693
Comments
that can't be taken as slightly as a bug - systemd-cryptsetup does not set discards on SSDs for a reason probably. We need to spike on this first to see what would be a good approach here, or even let this to be configurable by the end-user. See for instance also: https://wiki.debian.org/SSDOptimization on the topic. |
for the moment being - maybe we can investigate a workaround that does not require a patch release. E.g. a cloud config that can be shipped in the base image that reattach and remounts the partition with discard enabled on the HW that requires it. |
We do not need remounting of any mountpoints. All that's needed is kcrypt being adjusted to pass the |
workaround found:
|
@kreeuwijk confirmed this as working |
for reference, this is the workaround from @kreeuwijk :
|
Planning decision: Let's try to implement this in immucore and control it with a config flag (in Kairos config). |
After a small discussion
|
@Itxaka we can't you pass the |
We do? It's mentioned above, we will pass that to the crypt setup Luks creation by default? |
kcrypt and agent will now create the luks encrypted partitions with the allow-discard option always enabled. As the OS now have an auto-trim service running, I dont think we need to go any further. Trim will be auto-run and it should trim the system automatically. |
@kreeuwijk will this cover the current use-case? Encrypted partitions have the allow-discard option on by default, underlying mounts are NOT mounted witht he discard option, trim service still works on the timer. Or is there some scenario missing here? Notice that nobody recommends using the discard option on encrypted mounts by default as it weakens security, so we would prefer to NOT allow mounting the underlying partitions with the discard option. Feel free to to reopen if we are missing something here |
@Itxaka this is great, thank you! |
Kairos version:
3.0.14
CPU architecture, OS, and Version:
Ubuntu 24.04
Describe the bug
Kairos does not pass the
allow-discards
config option tosystemd-cryptsetup attach
, causing the mounted LUKS partitions to not support TRIM. As a result, SSD drive performance falls off a cliff after some time. When a LUKS partition is mounted from a non-rotational disk, theallow-discards
option should be automatically added so that weeklyfstrim
runs can trim the LUKS partitions as well.This example shows that
fstrim
functions correctly whenallow-discards
is set:To Reproduce
Deploy Kairos with Trusted Boot and attempt to run
fstrim -v /oem
Expected behavior
Non-rotational disks should use LUKS partitions that have TRIM support enabled.
The text was updated successfully, but these errors were encountered: