Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions install/login/limine-snapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ EOF

CMDLINE=$(grep "^[[:space:]]*cmdline:" "$limine_config" | head -1 | sed 's/^[[:space:]]*cmdline:[[:space:]]*//')

# Enable SSD TRIM passthrough for LUKS-encrypted drives
if [[ $CMDLINE == *"cryptdevice="* ]] && [[ $CMDLINE != *"allow-discards"* ]]; then
CMDLINE=$(echo "$CMDLINE" | sed 's/\(cryptdevice=[^ ]*\)/\1:allow-discards/')
Comment thread
stephentaylor-com marked this conversation as resolved.
Outdated
fi

sudo cp $OMARCHY_PATH/default/limine/default.conf /etc/default/limine
sudo sed -i "s|@@CMDLINE@@|$CMDLINE|g" /etc/default/limine

Expand Down
26 changes: 26 additions & 0 deletions migrations/1776500000.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
echo "Enable SSD TRIM for LUKS-encrypted drives"

# Only apply if the system uses LUKS encryption
if ! grep -q "cryptdevice=" /etc/default/limine 2>/dev/null; then
exit 0
fi

# Skip if allow-discards is already configured
if grep -q "allow-discards" /etc/default/limine 2>/dev/null; then
exit 0
fi

# Add :allow-discards to the cryptdevice= parameter in the boot config
# Format: cryptdevice=device:dmname -> cryptdevice=device:dmname:allow-discards
sudo sed -i 's/\(cryptdevice=[^ ]*\)/\1:allow-discards/' /etc/default/limine
Comment thread
stephentaylor-com marked this conversation as resolved.
Outdated

# Enable allow-discards on the running LUKS device so TRIM works immediately
if [[ -b /dev/mapper/root ]]; then
sudo cryptsetup --allow-discards --persistent refresh root
Comment thread
stephentaylor-com marked this conversation as resolved.
Outdated
fi

# Regenerate initramfs and boot entry
sudo limine-mkinitcpio
sudo limine-update

echo "SSD TRIM enabled for LUKS encryption"
Loading