Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


correct_way_to_enable_trim_for_ssd_s_on_centos_6.5

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
correct_way_to_enable_trim_for_ssd_s_on_centos_6.5 [2014/05/26 05:50] – [Test] admincorrect_way_to_enable_trim_for_ssd_s_on_centos_6.5 [2014/05/26 07:22] – [Filesystem] admin
Line 8: Line 8:
 ===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.<code>#! /bin/sh For example, configure a weekly fstrim job. Create **/etc/cron.weekly/fstrim**. This script will run fstrim on ext filesystems.<code>#! /bin/sh
-for mount in `lsblk -ro "name,kname,mountpoint,label,fstype" |egrep "ext[2|3|4]" | cut -d " " -f3`; do+for mount in `lsblk -ro "rota,rm,fstype,mountpoint" | egrep "0 0 ext[2|3|4]" | cut -d " " -f4`; do
  fstrim $mount  fstrim $mount
 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