How to enable TRIM for SSDs in Debian 6.0 “Squeeze”

Modern SSDs support the TRIM command for long-term sustained performance. However for TRIM to work right, the OS (and file system) must have support for it. In the case of Linux, you’ll need kernel version 2.6.33 or newer, use ext4 as file system and also tell the kernel to use TRIM using the “discard” mount option.

By default the Debian installer tends to prefer ext3, so be sure to change this to ext4 on a fresh install. If you have already installed Debian on a SSD with ext3, you will need to convert it to ext4 – I will not cover this here.

Debian 6.0 includes kernel version 2.6.32 by default. To use a newer kernel you do not need to turn to the testing or even unstable (Wheezy) distributions; just enable the (official) Squeeze Backports by adding this line to /etc/apt/sources.list

deb squeeze-backports main contrib non-free

Then run aptitude update to get the new package list. To upgrade to the latest kernel included with the backports that does support TRIM (2.6.39 at the time of writing) run:

aptitude install -t squeeze-backports linux-image-2.6-amd64

(change amd64 to i386 if you’re still running the 32-bit version of Debian)

To enable TRIM support then add the “discard” mount option to /etc/fstab: change the default “errors=remount-ro” into “errors=remount-ro,discard”. Reboot and you’re done.

Note! Do not add the “discard” option when your drive is formatted as ext3: not only will it not work, but it will prevent the OS from booting properly.

3 thoughts on “How to enable TRIM for SSDs in Debian 6.0 “Squeeze”

  1. Thanks for this – I didn’t realise Squeeze didn’t fully support TRIM – from seeing various articles I assumed the only requirement was an appropriate kernel – which doesn’t seem to be the case… oh well.

  2. This won’t work for me.
    After installing linux-image-2.6-amd64 and editing the fstab and rebooting the system comes:

    Wainting for /dev to be fully populated…[ 3.572773] SP5100 TCO timer: mmio address 0xfec000f0 already in use
    [ 4.767044] [drm] nouveau 0000:01:00.0: illegal object class: 0x902d