运行 fstrim 维护 SSD 性能

让 SSD 定期回收无用数据块,保持写入速度和寿命。

Linux固态硬盘存储磁盘裁剪中风险
执行 sudo fstrim -av 立即对所有已挂载 SSD 做一次 TRIM,或用 sudo systemctl enable --now fstrim.timer 开启每周自动整理。

01命令

命令
$ sudo fstrim -av

02作用说明

SSD 无法直接覆盖旧数据,只有当系统告诉它哪些块已删除,它才能回收空间。fstrim 就是把这些空闲块通知给硬盘,让写入速度和寿命保持在出厂水平。主流发行版都自带每周一次的 fstrim.timer,普通桌面用户开启即可,无需手动操作。

03风险

风险中风险
使用条件SSD or NVMe drive; root access. On Ubuntu/Debian/Arch the weekly fstrim.timer usually exists already and only needs enabling.
!注意: fstrim 只用于 SSD,机械硬盘不需要也不要执行。不建议改成每天 TRIM——每周一次足够,而且接近满盘时 TRIM 耗时较长,执行中不要中断。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • Solid state drive - ArchWiki
    Arch Wiki · community · 2026-09-17
    依据: Documents fstrim.timer as the recommended periodic TRIM mechanism for SSDs.
  • fstrim(8) — Arch Manual Pages
    Arch Linux · community · 2026-09-17
    依据: fstrim [-v] [-o offset] ... and the --all/--verbose flags are documented; the page notes fstrim discards unused blocks on a mounted filesystem.

最后验证: 2026-09-19 · 分类: 系统与设置

06相关方案