首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >"systemctl start fstrim.timer“用于ssd优化,而不是在Debian 10上工作

"systemctl start fstrim.timer“用于ssd优化,而不是在Debian 10上工作
EN

Unix & Linux用户
提问于 2020-10-19 20:55:49
回答 1查看 2.7K关注 0票数 -1

我刚刚安装了一个1TB的金斯顿SSD,我克隆了我的HDD (用Debian 10),所以除了性能没有什么改变,我想为这个SSD设置TRIM。

所以我做了这个:

代码语言:javascript
运行
复制
$ sudo hdparm -I /dev/sda | grep -i TRIM
           *    Data Set Management TRIM supported (limit 8 blocks)

$ sudo systemctl cat fstrim.service
# /lib/systemd/system/fstrim.service
[Unit]
Description=Discard unused blocks on filesystems from /etc/fstab
Documentation=man:fstrim(8)

[Service]
Type=oneshot
ExecStart=/sbin/fstrim -Av

$ sudo systemctl status fstrim.timer
● fstrim.timer - Discard unused blocks once a week
   Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
   Active: inactive (dead)
  Trigger: n/a
     Docs: man:fstrim

正如您在第三个命令的输出中看到的,fstrim.timer是非活动的,因此,要激活它,我认为我应该这样做:

$ sudo systemctl enable fstrim.service

其中产出:

代码语言:javascript
运行
复制
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
 
Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.

$ sudo systemctl start fstrim.timer

其中产出:

Failed to start fstrim.timer: Unit -.mount is masked.

所以我不知道那里发生了什么,我已经研究了如何解决这个问题,但是我找不到合适的答案,我希望有人能在这里帮助我,谢谢。

EN

回答 1

Unix & Linux用户

发布于 2020-10-20 17:24:39

正如ajgringo619所言,我做了:sudo systemctl unmask fstrim.timer

然后启动fstrim.timer,并擦了一下状态,一切都很好。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/615337

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档