6

Linux 中对 SSD 的优化 Discard,类 TRIM 的功能

 3 years ago
source link: https://blogread.cn/it/article/2800?f=hot1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Linux 中对 SSD 的优化 Discard,类 TRIM 的功能

浏览:3607次  出处信息

我现在使用的是一个三星的 SSD 的硬盘。SSD 有一个通用的问题,就是使用久了,会变慢,因为一些 SSD 本身的设计问题.详细原因各位 google 一下。

我们知道,常用的解决方法是 win7 支持的 TRIM 。在 Linux 以前一直没有很好的解决方法,当然,因为 ext* 的文件系统本身的分组设计,看的影响没有 win 那么明显。在最新的 2.6. 32 以后, Linux 开发了一个对 SSD 更加友好的东西,就是 Discard 的功能。

嗯,正好使用的 Ubuntu 10.10 做的桌面,来玩玩,有空测试一下性能。

使用起来相当容易,就是在 mount 的时候,加一个参数 discard  来启用这个功能:

/dev/sda1 / ext4 discard,defaults

 另外根据原理,还有一些其它的小建议,那个有空给个测试的数据吧

1. 给 IO 的算法修改成 noop,操作系统本身不做处理,让 ssd 本身处理。

echo noop >  /sys/block/sda/queue/scheduler

2. 修改 atime 的功能,让 ssd 少操作,没有必要要这个信息。 

/dev/sdb1 /  ext4    errors=remount-ro,noatime,discard

建议继续学习:

QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK