Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


correct_way_to_enable_trim_for_ssd_s_on_centos_6.5

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
correct_way_to_enable_trim_for_ssd_s_on_centos_6.5 [2014/05/26 07:22] admincorrect_way_to_enable_trim_for_ssd_s_on_centos_6.5 [2014/05/26 08:01] – [Correct way to enable trim] admin
Line 1: Line 1:
 =====Correct way to enable trim===== =====Correct way to enable trim=====
-Use a more recent kernel, for example ELRepo's kernel-ml 3.14. 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.+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==== ====Filesystem====
 Realtime discards can slow down performance, use scheduled fstrim instead. Realtime discards can slow down performance, use scheduled fstrim instead.
Line 7: Line 7:
  
 ===Scheduled trim with fstrim=== ===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.<code>#! /bin/sh+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.<code>#!/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 for mount in `lsblk -ro "rota,rm,fstype,mountpoint" | egrep "0 0 ext[2|3|4]" | cut -d " " -f4`; do
- fstrim $mount+  printf "`date` - `fstrim -v $mount`\n" >>$trimlog
 done</code> done</code>
  
correct_way_to_enable_trim_for_ssd_s_on_centos_6.5.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1