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.