← 返回命令列表

Linux command

fstrim 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Example

sudo fstrim -a

Example

sudo fstrim /

Example

sudo fstrim -v /

说明

fstrim discards unused blocks on a mounted filesystem, sending TRIM commands to the underlying storage device. This is primarily useful for SSDs and flash storage to maintain performance and extend device lifespan.

参数

-a, --all
Trim all mounted filesystems that support discard
-v, --verbose
Display number of bytes trimmed
-n, --dry-run
Print what would be done without actually trimming
-o, --offset _offset_
Byte offset in filesystem to start trimming
-l, --length _length_
Number of bytes to trim after offset
-m, --minimum _size_
Minimum contiguous free range to trim

FAQ

What is the fstrim command used for?

fstrim discards unused blocks on a mounted filesystem, sending TRIM commands to the underlying storage device. This is primarily useful for SSDs and flash storage to maintain performance and extend device lifespan.

How do I run a basic fstrim example?

Run `sudo fstrim -a` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --all do in fstrim?

Trim all mounted filesystems that support discard