2019年5月24日星期五

Centos7开启TRIM的方法

安装hdparm:
yum install hdparm -y

检测硬盘是否支持TRIM:
hdparm -I /dev/sda | grep TRIM
   * Data Set Management TRIM supported (limit 8 blocks)

可以先手动TRIM一次:
fstrim --verbose --all
/boot: 752.3 MiB (788824064 bytes) trimmed
/: 89.1 GiB (95708200960 bytes) trimmed

开启TRIM服务,每周会TRIM一次,不需要手动TRIM:
systemctl status fstrim.timer
systemctl start fstrim.timer
systemctl enable fstrim.timer

另外,还可以将/tmp设置为tmpfs,这会将/tmp挂载在内存中,进一步优化SSD寿命。
systemctl start tmp.mount
systemctl enable tmp.mount

没有评论:

发表评论

更换阿里云源

CentOS 7: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http:/...