
怎么查看固态硬盘开启discard
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
-
- 帖子: 4
- 注册时间: 2016-04-22 20:43
- 系统: windows10
怎么查看固态硬盘开启discard
还有怎么在/etc/fstab里写东西啊,初来乍到,还望多多指教 

-
- 论坛版主
- 帖子: 18279
- 注册时间: 2009-08-04 16:33
Re: 怎么查看固态硬盘开启discard
參閱
http://askubuntu.com/questions/443761/h ... im-enabled
Conclusion from that link in German:
cron job on weekly basis since discard will lead to too much of a performance hit.
http://askubuntu.com/questions/443761/h ... im-enabled
Conclusion from that link in German:
cron job on weekly basis since discard will lead to too much of a performance hit.
-
- 帖子: 893
- 注册时间: 2011-02-14 17:46
Re: 怎么查看固态硬盘开启discard
例如
UUID=uuid / ext4 noatime,nodiratime,errors=remount-ro 0 1
把,discard加在红字的后面就行
但是一般不建议discard,建议的是手动定时fstrim
另外现在16.04在/etc/cron.weekly/fstrim中,已经对所有SSD都定时跑trim了,所以不用加discard
UUID=uuid / ext4 noatime,nodiratime,errors=remount-ro 0 1
把,discard加在红字的后面就行
但是一般不建议discard,建议的是手动定时fstrim
另外现在16.04在/etc/cron.weekly/fstrim中,已经对所有SSD都定时跑trim了,所以不用加discard
- kashu
- 帖子: 451
- 注册时间: 2014-02-07 17:31
- 系统: Xubuntu 14.04.5 64位
Re: 怎么查看固态硬盘开启discard
不要用discard。
Why Doesn’t Ubuntu TRIM By Default?
http://www.howtogeek.com/176978/ubuntu- ... t-yourself
cat /etc/cron.weekly/fstrim(来自:Xubuntu 14.04.4 LTS)
要先确定所用的SSD在当前的Xubuntu系统上是否支持TRIM,然后再决定是否要设置定期fstrim,默认每周的fstrim-all只处理Intel和三星厂商的固态硬盘。
上面的脚本代码不适用于所有的人,如:电脑里装有不同厂商的多块SSD,其中有的SSD支持TRIM,有的却不支持,那请不要使用这脚本。只使用同一厂商的,这脚本应该可以。(另:不太清楚16.04在SSD的TRIM上有没有变化,我现在还没用过16.04
)
[/size]
Why Doesn’t Ubuntu TRIM By Default?
http://www.howtogeek.com/176978/ubuntu- ... t-yourself
cat /etc/cron.weekly/fstrim(来自:Xubuntu 14.04.4 LTS)
# This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty
# firmware may encounter data loss problems when running fstrim under high I/O
# load (e. g. https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives.
要先确定所用的SSD在当前的Xubuntu系统上是否支持TRIM,然后再决定是否要设置定期fstrim,默认每周的fstrim-all只处理Intel和三星厂商的固态硬盘。
代码: 全选
# SSD TRIM (More: http://www.howtogeek.com/176978/ubuntu-doesnt-trim-ssds-by-default-why-not-and-how-to-enable-it-yourself)
for DISK in $(fdisk -l 2> /dev/null | grep -i "^Disk /" | awk -F'[ |:]' '{print $2}'); do
hdparm -I ${DISK} | grep -sqim1 "TRIM supported" && { trim_enable=1; break; }
done
if [ "${trim_enable}" -eq 1 ]; then
if `grep -m1 "^exec fstrim-all" /etc/cron.weekly/fstrim | grep -sqv "no-model-check"`; then
sed -i 's/^exec/#exec/g' /etc/cron.weekly/fstrim
echo 'exec fstrim-all --no-model-check' >> /etc/cron.weekly/fstrim
fi
fi

[/size]
OS: Xubuntu 14.04.5 LTS 64-bit
CPU: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
RAM: 12GB DDR3 1333MHz
128GB SSD + 2TB HDD
神舟优雅A480B-I5B 购于 2012.08
YouTube频道:https://www.youtube.com/channel/UCGSPXZ ... DuDYX8L6Qg
-
- 帖子: 4
- 注册时间: 2016-04-22 20:43
- 系统: windows10
Re: 怎么查看固态硬盘开启discard
rosynirvana 写了:例如
UUID=uuid / ext4 noatime,nodiratime,errors=remount-ro 0 1
把,discard加在红字的后面就行
但是一般不建议discard,建议的是手动定时fstrim
另外现在16.04在/etc/cron.weekly/fstrim中,已经对所有SSD都定时跑trim了,所以不用加discard
这个是自动的吗?

-
- 帖子: 4
- 注册时间: 2016-04-22 20:43
- 系统: windows10
Re: 怎么查看固态硬盘开启discard
poloshiao 写了:參閱
http://askubuntu.com/questions/443761/h ... im-enabled
Conclusion from that link in German:
cron job on weekly basis since discard will lead to too much of a performance hit.

-
- 帖子: 4
- 注册时间: 2016-04-22 20:43
- 系统: windows10
Re: 怎么查看固态硬盘开启discard
用的镁光M4,这个支持trimkashu 写了:不要用discard。
Why Doesn’t Ubuntu TRIM By Default?
http://www.howtogeek.com/176978/ubuntu- ... t-yourself
cat /etc/cron.weekly/fstrim(来自:Xubuntu 14.04.4 LTS)# This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty
# firmware may encounter data loss problems when running fstrim under high I/O
# load (e. g. https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives.
要先确定所用的SSD在当前的Xubuntu系统上是否支持TRIM,然后再决定是否要设置定期fstrim,默认每周的fstrim-all只处理Intel和三星厂商的固态硬盘。上面的脚本代码不适用于所有的人,如:电脑里装有不同厂商的多块SSD,其中有的SSD支持TRIM,有的却不支持,那请不要使用这脚本。只使用同一厂商的,这脚本应该可以。(另:不太清楚16.04在SSD的TRIM上有没有变化,我现在还没用过16.04代码: 全选
# SSD TRIM (More: http://www.howtogeek.com/176978/ubuntu-doesnt-trim-ssds-by-default-why-not-and-how-to-enable-it-yourself) for DISK in $(fdisk -l 2> /dev/null | grep -i "^Disk /" | awk -F'[ |:]' '{print $2}'); do hdparm -I ${DISK} | grep -sqim1 "TRIM supported" && { trim_enable=1; break; } done if [ "${trim_enable}" -eq 1 ]; then if `grep -m1 "^exec fstrim-all" /etc/cron.weekly/fstrim | grep -sqv "no-model-check"`; then sed -i 's/^exec/#exec/g' /etc/cron.weekly/fstrim echo 'exec fstrim-all --no-model-check' >> /etc/cron.weekly/fstrim fi fi
)
[/size]

-
- 帖子: 893
- 注册时间: 2011-02-14 17:46
Re: 怎么查看固态硬盘开启discard
是,每周自动跑一次沐风栉雨 写了:rosynirvana 写了:例如
UUID=uuid / ext4 noatime,nodiratime,errors=remount-ro 0 1
把,discard加在红字的后面就行
但是一般不建议discard,建议的是手动定时fstrim
另外现在16.04在/etc/cron.weekly/fstrim中,已经对所有SSD都定时跑trim了,所以不用加discard
这个是自动的吗?
- kashu
- 帖子: 451
- 注册时间: 2014-02-07 17:31
- 系统: Xubuntu 14.04.5 64位
Re: 怎么查看固态硬盘开启discard
rosynirvana 写了: 是,每周自动跑一次
我想问一下,在16.04里,那个每周计划任务里,现在fstrim-all是支持对所有厂商的固态硬盘的TRIM吗?
还是像14.04一样,“only runs on Intel and Samsung SSDs by default”?
OS: Xubuntu 14.04.5 LTS 64-bit
CPU: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
RAM: 12GB DDR3 1333MHz
128GB SSD + 2TB HDD
神舟优雅A480B-I5B 购于 2012.08
YouTube频道:https://www.youtube.com/channel/UCGSPXZ ... DuDYX8L6Qg
-
- 帖子: 893
- 注册时间: 2011-02-14 17:46
Re: 怎么查看固态硬盘开启discard
如果fstrim --all是对于部分厂商的SSD做trim,那14.04的脚本就没必要写厂商检测的函数了kashu 写了:rosynirvana 写了: 是,每周自动跑一次
我想问一下,在16.04里,那个每周计划任务里,现在fstrim-all是支持对所有厂商的固态硬盘的TRIM吗?
还是像14.04一样,“only runs on Intel and Samsung SSDs by default”?
- kashu
- 帖子: 451
- 注册时间: 2014-02-07 17:31
- 系统: Xubuntu 14.04.5 64位
Re: 怎么查看固态硬盘开启discard
OS: Xubuntu 14.04.5 LTS 64-bit
CPU: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
RAM: 12GB DDR3 1333MHz
128GB SSD + 2TB HDD
神舟优雅A480B-I5B 购于 2012.08
YouTube频道:https://www.youtube.com/channel/UCGSPXZ ... DuDYX8L6Qg
-
- 帖子: 5
- 注册时间: 2016-04-20 3:21
- 系统: windows7
Re: 怎么查看固态硬盘开启discard
写的东西真的看不懂