Trim Question - fstrim on dual boot system (Windows 10 + Manjaro)

Hey Everyone,

There was a post on here recently talking about making sure fstrim was enabled. My question is if I’m running a dual boot configuration on my laptop (Windows 10 + Manjaro), will fstrim perform a trim on ALL my partitions (including Windows 10 NTFS)?

Or do I need to do something separate on the Windows side to make sure trim is working?

Thanks in advance to everyone for your time and help, it is greatly appreciated!

It will trim all filesystems that are mounted read/write. :slight_smile:

Thank you, and the only thing to activate and schedule the timer is to run the following command:

systemctl enable --now fstrim.timer

Is that correct? This will automatically add it to a weekly schedule?

Thanks.

Yes. You can see the config with systemctl cat fstrim.timer

# /usr/lib/systemd/system/fstrim.timer
[Unit]
Description=Discard unused filesystem blocks once a week
Documentation=man:fstrim
ConditionVirtualization=!container
ConditionPathExists=!/etc/initrd-release

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

[Install]
WantedBy=timers.target

Yes, that is correct. But bear in mind that the trim is scheduled for Sunday night at midnight, so if your machine is not running at that point in time, it’ll be executed upon the next boot.

Thanks for all the details everyone. I have successfully enabled the service. I did do a test run and noticed it ONLY did my Linux partitions. I did not see any trimming of my Windows NTFS partition.

Is there additional steps I need to enable for it to Trim my Windows partition correctly?

Thank you!

Just as an addendum, fstrim can be run manually with:

sudo fstrim / -v

this will trim any drive that is an SSD or NVME, starting in the / directory. If the /var directory was mounted on a separate SSD, and you wanted just to trim that drive, you would run the following;

sudo fstrim /var -v

after fstrim runs, it will tell you how much it trimmed, if it seems to take a long time, it may have a lot to do.

1 Like

It’s good to run this yourself now and then. You can see how bad you needed to TRIM. You don’t hurt anything by running it, just performance for the brief time it needs to erase cells, which takes longer the less you do it. This only improvements write performance, and does not increase wear on your drive, and does the opposite.

if I leave it a whole week, I know it is not near enough for my system for the hundreds of gigs it trims. So here is how to change it to daily (or whenever you want).

To change it without changing the /usr/lib/systemd unit, and override it in /etc/systemd (so you don’t have to deal with pacsave files on this), run this:

sudo systemctl edit fstrim.timer

Add the two lines between the comments at the top.

### Editing /etc/systemd/system/fstrim.timer.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file

[Timer]
OnCalendar=daily

### Edits below this comment will be discarded


### /usr/lib/systemd/system/fstrim.timer
# [Unit]
# Description=Discard unused filesystem blocks once a week
# Documentation=man:fstrim
# ConditionVirtualization=!container
# ConditionPathExists=!/etc/initrd-release
# 
# [Timer]
# OnCalendar=weekly
# AccuracySec=1h
# Persistent=true
# RandomizedDelaySec=100min
# 
# [Install]
# WantedBy=timers.target

You may want to add a third line and change RandomizedDelaySec=100min to something less (or 0) as well.

This will execute at midnight, or the next boot following. If you want a specific time, it follows cron type format. (days-of-week) YYYY-MM-DD HH:MM:SS

(man systemd.time)

For example:

Every day at 2am

OnCalendar=*-*-* 00:02:00

Certain days of the week

OnCalendar=Mon,Thu,Sat *-*-* 00:00:00

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.