=====Correct way to enable trim===== Use a more recent kernel. Full support for TRIM was not added to the Linux kernel until version 3.7. But... since TRIM is officially supported on CentOS 6, you could assume that RH have backported all the necessary fixes for it to work properly. ====Filesystem==== Realtime discards can slow down performance, use scheduled fstrim instead. ===Discard mount option=== If you don't want to configure a scheduled fstrim job, add 'discard' to mount options in **/etc/fstab**. /dev/mapper/vg-lv_root / ext4 defaults,noatime,discard,commit=60 1 1 ===Scheduled trim with fstrim=== For example, configure a weekly fstrim job. Create **/etc/cron.weekly/fstrim**. This script will run fstrim on ext filesystems which are non removable and not rotational.#!/bin/sh #this script will run weekly, will overwrite log. trimlog=/var/log/fstrim.log echo > $trimlog for mount in `lsblk -ro "rota,rm,fstype,mountpoint" | egrep "0 0 ext[2|3|4]" | cut -d " " -f4`; do printf "`date` - `fstrim -v $mount`\n" >>$trimlog done ====dm-crypt==== Edit **/etc/crypttab** and add the discard option. # sda2_crypt /dev/sda2 none luks,discard ====LVM==== Edit **/etc/lvm/lvm.conf** and enable issue_discards. The "discard" options with on-disk-cryptography (like dm-crypt) have drawbacks with security/cryptography. See crypttab(5). issue_discards = 1 ====Update initramfs==== * Update the initramfs. dracut -f * reboot ====Test==== Test with lsblk, DISC-GRAN and DISC-MAX should **not** be '0B' for SSD backed partitons and filesystems. $ lsblk -D NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO sda 0 512B 2G 0 ├─sda1 0 512B 2G 0 └─sda2 0 512B 2G 0 ├─vg-lv_swap (dm-0) 0 512B 2G 0 ├─vg-lv_root (dm-1) 0 512B 2G 0 ├─vg-lv_var (dm-2) 0 512B 2G 0 └─vg-lv_home (dm-3) 0 512B 2G 0 sdc 0 0B 0B 0 └─sdc1 0 0B 0B 0