fstrim is used on a mounted filesystem to discard (or "trim") blocks
which are not in use by the filesystem. This is useful for solid-
state drives (SSDs) and thinly-provisioned storage.
By default, fstrim will discard all unused blocks in the filesystem.
Options may be used to modify this behavior based on range or size,
as explained below.
The mountpoint argument is the pathname of the directory where the
filesystem is mounted.
Running fstrim frequently, or even using mount -o discard, might
negatively affect the lifetime of poor-quality SSD devices. For most
desktop and server systems a sufficient trimming frequency is once a
week. Note that not all devices support a queued trim, so each trim
command incurs a performance penalty on whatever else might be trying
to use the disk at the time.
http://www.man7.org/linux/man-pages/man8/fstrim.8.html 说的很清楚,在写入数据的前擦除了未使用的空间这个就是trim,而不是在写入时同时进行擦除,因此trim可以提高文件保存性,官方建议一周最多trim文件目录一次,频繁trim会影响ssd的使用寿命
收起