我刚刚安装了一个1TB的金斯顿SSD,我克隆了我的HDD (用Debian 10),所以除了性能没有什么改变,我想为这个SSD设置TRIM。
所以我做了这个:
$ 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
其中产出:
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.
所以我不知道那里发生了什么,我已经研究了如何解决这个问题,但是我找不到合适的答案,我希望有人能在这里帮助我,谢谢。
发布于 2020-10-20 17:24:39
正如ajgringo619所言,我做了:sudo systemctl unmask fstrim.timer
然后启动fstrim.timer,并擦了一下状态,一切都很好。
https://unix.stackexchange.com/questions/615337
复制相似问题