I like to have my laptop encrypted in case I loose it or it get's stolen. This way I don't need to worry about the data I have stored on it. Since I'm having an SSD in my laptop it's necessary that I change some configs to have it supporting TRIM. TRIM is needed to have the SSD functioning correctly. I did this on Debian Jessie but it will most likely work with other distros as well.

Configuration

We need to edit two files to get TRIM working. The first one is /etc/fstab. Simply add the discard parameter to the probably already present parameters.

Before

/dev/mapper/volumegroup-root    /    ext4    noatime,nodiratime,errors=remount-ro    0    1

after

/dev/mapper/volumegroup-root    /    ext4    discard,noatime,nodiratime,errors=remount-ro    0    1

The second file we need to update is /etc/crypttab as before we simply need to add the discard parameter to the already presents parameter.

before

sda5_crypt UUID=e364d03f-[...]6cd7e none luks

after

sda5_crypt UUID=e364d03f-[...]6cd7e none luks,discard

To finally apply the new settings we have to run a single command:

sudo update-initramfs -u -k all

After that we're good to go and TRIM should work.

Resources

Next Post Previous Post