Trim enabled. Does it affect second HDD drive?

So I enabled trim for my SDD but also have a second HDD drive for storage (I might just take it out). Will this affect the HDD?

No, trim doesn’t run on drives that don’t support it.

2 Likes

Thanks!

1 Like

What If I have 2 partitions with EnOS on the same SDD. Do I need to enable it for both?

I assume you’ve enabled the fstrim.timer? That issues fstrim with the -a option, which trims all supported devices/partitions.

Do you mean you have 2 separate installations of EOS? In that case, you probably want to enable fstrim.timer in both installations.

1 Like

Yes I have, like I was told here.

Yes 2 installations. One for KDE and one for Cinnamon.

If you enable fstrim.timer on both be aware that in both systems all mounted partitions are trimmed. i.e. if you have partitions being mounted in both OS those will be trimmed twice. This could be changed by editing the trim config file.

2 Likes

depending on the usage of the two installations… logical TRIM will start weekly if you enable timer, so if you enable it on a install you do not use on a daily basis… it could be that this timer never TRIM the devices… If you run them both in the same way you should enable the TRIM timer on both…

3 Likes

It looks like that fstrim.service runs trim on the filesystems specified in /etc/fstab:

cat /usr/lib/systemd/system/fstrim.service
[Unit]
Description=Discard unused blocks on filesystems from /etc/fstab
Documentation=man:fstrim(8)
ConditionVirtualization=!container

[Service]
Type=oneshot
ExecStart=/usr/bin/fstrim --listed-in /etc/fstab:/proc/self/mountinfo --verbose --quiet-unsupported
PrivateDevices=no
PrivateNetwork=yes
PrivateUsers=no
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
MemoryDenyWriteExecute=yes
SystemCallFilter=@default @file-system @basic-io @system-service

So I guess if you want your second partition be trimmed from the first one, you would need to add it to fstab. But I fail to see the point.

1 Like

or this:

╰─$ cat /usr/lib/systemd/system/fstrim.timer 
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim
ConditionVirtualization=!container

[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true
RandomizedDelaySec=6000

[Install]
WantedBy=timers.target

3 Likes

Well, then 1 can trim the SDD, I don’t need it on both right?

yes the one you are using daily can be the one do the TRIM …

2 Likes

Before trimming is activated (once a week) I would recommend to temporarily mount the partition(s) from the other system to make sure it’s trimmed as well. I don’t think it will be trimmed if not being mounted.

Alternatively (that’s what I’m currently doing), you could enable fstrim.timer on one system and trim the (usually unmounted) partitions of the other system once a week by CLI-command e.g. for / partition by

sudo fstrim -v /

Or you adjust your fstrim config file.

1 Like

Is there any ill effects in case the 2nd partition isn’t being trimmed?

That depends on how full the partition is. If the partition is relatively empty, and you don’t use it very much, you can go a long time between trims.

But personally, I’d still trim it periodically.

1 Like

there should be a manual command to do 1 trim when you feel like it.

sudo fstrim -a

or

sudo fstrim -av, which gives a bit of verbose output.

doesn’t that require the service to be active?

Nope, that issues fstrim directly.

2 Likes