The officially official Devuan Forum!

You are not logged in.

#1 2025-11-25 12:29:30

Altoid
Member
Registered: 2017-05-07
Posts: 1,949  

[SOLVED] fstrim and HDDs

Hello:

Ever since I put my system on a 2.5" 120Gb SSD, I set up fstrim as per the instructions I found on-line:

$ ls -1 /etc/cron.weekly
--- snip ---
dev-fstrim
--- snip ---
$ 
$ cat /etc/cron.weekly/dev-fstrim
#!/bin/sh
# trim all mounted file systems which support it
# added 20200315
#
# PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
LOG=/var/log/trim.log
echo "On $(date -R):" >> $LOG
/sbin/fstrim -a -v >> "$LOG" 2>&1
$ 

I then took to checking /var/log/trim.log every so often to check that it was working and eventually stopped doing it.
fstrim was doing it's thing and doing it well.
If anything went south, my MTA (not Exim4, DMA*) would let me know.

Today I was looking through the logs and on opening /var/log/trim.log I see that it is also working (?) on a 2.5" 1Tb HDD that I set up inside my box to serve as the first repository of my weekly Clonezilla and daily Timeshift backups.

$ cat /var/log/trim.log
--- snip ---
On Thu, 20 Nov 2025 02:11:33 -0300:
/media/1TB/IMG: 109.2 GiB (117271797760 bytes) trimmed on /dev/sda1
/media/1TB/TS: 159.1 GiB (170784149504 bytes) trimmed on /dev/sda2
/home: 27.2 GiB (29253963776 bytes) trimmed on /dev/sdb6
/var/log: 669.7 MiB (702242816 bytes) trimmed on /dev/sdb5
/: 27.4 GiB (29410951168 bytes) trimmed on /dev/sdb1
$

This was something I was not expecting.
And I understand that fstrim is not for use with HDDs, only for SDDs.

I recall adding the comments to the /etc/cron.weekly/dev-fstrim so I would remember what it was doing and the bit "# trim all mounted file systems which support it" stuck with me and I (incorrectly) assumed that support it meant that fstrim would act only on SSDs.
Unfortunately I neglected to add the link to the source of the data.

Q:
Should I leave things as they are or not?
If not, what to do?

Best,

A.

*Dragonfly Mail Agent  <-- useful reading

Last edited by Altoid (2025-11-25 12:33:30)

Offline

#2 2025-11-25 13:17:56

g4sra
Member
Registered: 2018-12-12
Posts: 114  

Re: [SOLVED] fstrim and HDDs

sudo smartctl -i /dev/sda | grep Rotation

Offline

#3 2025-11-25 14:02:44

Altoid
Member
Registered: 2017-05-07
Posts: 1,949  

Re: [SOLVED] fstrim and HDDs

Hello:

g4sra wrote:
sudo smartctl -i /dev/sda | grep Rotation

Right ...

# smartctl -i /dev/sda
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.1.0-41-amd64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Blue Mobile (SMR)
Device Model:     WDC WD10SPZX-80Z10T2
Serial Number:    WD-WXD2A70DDH3S
LU WWN Device Id: 5 0014ee 212db172a
Firmware Version: 04.01A04
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm                                 ##### <--- HDD / spinning rust
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic                 ##### <--- accepts TRIM 
Device is:        In smartctl database 7.3/5319
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Tue Nov 25 10:25:51 2025 -03
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
# 

My question was more than anything oriented to the utility of fstrim on spinning rust.
I have read on the web that, while it does no harm, it is also useless.

Edit:
It seems that while the firmware actually accepts the TRIM command, it is ignored.

1A blurb on the web about the WDC WD10SPZX wrote:

---
TRIM is supported, but not actively used: The drive's specifications indicate that clearing unused data (TRIM) is "supported" as part of its general ATA command set (ACS-3). However, TRIM is primarily an optimization feature for SSDs, where it helps manage data blocks to maintain write performance and longevity.

HDD operation: As a traditional HDD with spinning platters and magnetic storage, the WD10SPZX manages data internally through standard garbage collection and wear-leveling algorithms specific to mechanical drives. The TRIM command, while technically part of the command set, does no have the same functional effect as it does on flash-based storage (SSDs).
---

I guess that if fstrim is ignored by the HDD firmware (and does nothing in spite of reporting to the log file), I could leave things as they are.

Thanks for your input.

Best,

A.

Offline

#4 2025-11-25 14:58:07

EDX-0
Member
Registered: 2020-12-12
Posts: 187  

Re: [SOLVED] fstrim and HDDs

it all depends on the specific hard drive, yours has a firmware scheme that accepts trim but ignores it, others may actively make use of the trim instruction but handle it differently at the firmware/hardware level

Offline

#5 2025-11-26 00:23:52

Altoid
Member
Registered: 2017-05-07
Posts: 1,949  

Re: [SOLVED] fstrim and HDDs

Hello:

EDX-0 wrote:

... depends on the specific hard drive ...
... accepts trim but ignores it ...

I'm just guessing.
I have not been able to find any information as to what is going on in a case such as mine.

But if the firmware ignores the TRIM command, why is it reported in the log?

/media/1TB/IMG: 109.2 GiB (117271797760 bytes) trimmed on /dev/sda1
/media/1TB/TS: 159.1 GiB (170784149504 bytes) trimmed on /dev/sda2

Shouldn't it log something akin to this instead?

/media/1TB/IMG: 109.2 GiB - TRIM command ignored on /dev/sda1
/media/1TB/TS: 159.1 GiB - TRIM command ignored on /dev/sda2

No matter, does not seem to cause any issues.

Thanks for your input.

Best,

A.

Offline

#6 2025-11-26 00:30:18

g4sra
Member
Registered: 2018-12-12
Posts: 114  

Re: [SOLVED] fstrim and HDDs

why is it reported in the log?

I would surmise the filesystem is ext4 which does support discard.

Offline

#7 2025-11-26 05:23:04

EDX-0
Member
Registered: 2020-12-12
Posts: 187  

Re: [SOLVED] fstrim and HDDs

technically the logs are correct, fstrim sends the trim operation to every mounted partition with a filesystem that supports it, the discard is calculated and then passed from the filesystem (through the kernel i'd assume) onto the drive's firmware, the firmware accepts the trim operation with the provided discard parameters, reports back that the proposed operation was accepted but then ignores it internally as the firmware does it's own handling of empty/unused space, the kernel gets the success status back to fstrim and fstrim reports back that the operation was a success and prints out the output that as far as the process is concerned was correct, fstrim simply has no way to know that the drive's firmware is lying while ignoring the trim and discard so the log output is "correct"

Offline

#8 2025-11-26 10:13:35

Altoid
Member
Registered: 2017-05-07
Posts: 1,949  

Re: [SOLVED] fstrim and HDDs

Hello:

g4sra wrote:

... filesystem is ext4 which does support discard.

I see.

EDX-0 wrote:

technically the logs are correct ...
fstrim simply has no way to know ...

Makes sense.
Thank you very much for taking the time to write it up.

Best,

A.

Last edited by Altoid (2025-11-26 23:20:39)

Offline

#9 2025-11-26 23:54:22

Altoid
Member
Registered: 2017-05-07
Posts: 1,949  

Re: [SOLVED] fstrim and HDDs

Hello:

g4sra wrote:

... filesystem is ext4 which does support discard.

After thinking about this for a while I decided to contact WD support to see if they can explain if the [TRIM] command actually does something.

I should have a reply in a matter of days.

Then I found this page.
I don't undertsand much of what it says, but it would seem that the [TRIM] command does have a function in HDDs using SMR (Shingled Magnetic Recording).

See this white paper* https://www.senetic.ci/i/objects/mmo_76 … 06_478.pdf
* p. 3 - Benefits for an SMR Drive

I'll post again if / when I get a reply from WD.

Best,

A.

Last edited by Altoid (2025-11-26 23:56:25)

Offline

#10 2025-12-02 23:46:17

Altoid
Member
Registered: 2017-05-07
Posts: 1,949  

Re: [SOLVED] fstrim and HDDs

Hello:

I wrote:

... post again if / when I get a reply ...

Got a reply after a few days.
As expected, nothing new, just the obvious:

WD support wrote:

Recently you requested personal assistance ...
Blah, blah, blah.
--- snip ---
... you'd like to clarify what TRIM does. <- Yes, on a HDD
... TRIM is an Advanced Technology Attachment (ATA) command. <- Really?
... allows the operating system to tell the HDD when it can delete data blocks so they can be reused ...  <- must be magic.
... works with Garbage Collection to clean up the drive. It can improve performance and extend the life of the drive.<- HDDs?
--- snip ---

As you can gather, my specific question was *not* answered.
ie: just what does [TRIM] do on a HDD (spinning rust)?

Further on there is a link which takes me to a page that does not have a link to the only WD document* with some information on what I wanted to know albeit with no clear answer.
* It is linked to on my previous post.

So no, no surprises here.

Best,

A.

Last edited by Altoid (2025-12-02 23:48:05)

Offline

#11 Yesterday 18:41:12

Altoid
Member
Registered: 2017-05-07
Posts: 1,949  

Re: [SOLVED] fstrim and HDDs

Hello:

I wrote:

So no, no surprises here.

Crikey!!!
Was I ever wrong!

Shortly after I received the reply to my query from the chaps at WD, they sent me an email asking for my opinion on their tech support.
Email which, although ignored, they sent again sometime later.
And then again.

Not wanting to let them down and now feeling inclined to oblige, I replied.

As subtly as possible I wrote that I found their tech support to be lacking as my question had not been answered.
And that no, I would not in any way recommend their products.
And left it at that.

Not to be deterred, WD once again reached out to me, as always in html format.
So, for the amusement of all my fellow forum members, what follows is the complete and unabridged content of their last email:

WD Tech Support wrote:

Incident Update
Case #: 9554268 | Reference #: 251127-000612

Hello Julius Henry*, 
 
We would like to inform you that we have escalated your question to our engineers and will send you their response below:

Thank you for your interest in our products. The information you’re requesting is not publicly available. If you’d like to engage with us on a more strategic level, which would involve purchase minimums and non-disclosure agreements, please complete this form and choose the topic “Looking to Purchase (For Business).

https://www.westerndigital.com/company/contact-us
 
Unfortunately, we don't support Linux, so we can't comment on the status of the logs you provided. If you'd like to check the drive's functionality, we recommend connecting it to a Windows computer and using our WD Kitfox tool:

Download, install, test, and erase data using Western Digital Kitfox: https://support-en.wd.com/app/answers/d … a_id/51537
 
If you have any further questions, please reply to this email and we will be happy to assist.
 
Alternatively Julius Henry, you can start a live chat with one of our support specialists on this link  - at the bottom right of the new page, just click the chat bubble! If you prefer to call us, click here. 

Sincerely,
Dmitro D
Western Digital Customer Service and Support
https://www.westerndigital.com/en-gb/support

Please note a 30-second support survey will be sent to your email later. We look forward to your feedback. Thank you for your understanding and support.

Note: If you have not visited our community forums, please make sure to do so.  You may also find answer(s) to your question(s) there. Link to WD community forums at: https://community.wd.com .

This electronic message contains information from Western Digital, is intended only for the use of the addressee and may contain information that is confidential.  The dissemination of this information is strictly prohibited.  If you have received this electronic transmission in error, please respond back to this e-mail or contact us by phone.

In order to process your email, please do not remove this reference #: 251127-000612
Get More Help
• Check our Knowledge Base for helpful articles and FAQs.
• Explore our WD Community forum or visit the Western Digital Support YouTube channel for helpful resources and support.

Update Incident
Case Details

Case Number: 251127-000612
Subject: TS fstrim and mechanical HDDs
Product: WD Blue 2.5"
Date: 11/26/2025 01:44 PM
To unsubscribe or update your email preferences, please click here.

Please note: This e-mail message was sent from a notification-only address that cannot accept incoming e-mail. Please do not reply to this message.
© 2025 Western Digital Corporation or its affiliates. All rights reserved.
Contact Us
FAQ
My Account
Terms of Use
Privacy Statement
Terms of Sale
5601 Great Oaks Parkway, San Jose, CA 95119 USA
[---002:002426:50328---]

I found most interesting the references to the information requested not being "publicly available", engaging with them "on a more strategic level" and the "purchase minimums and non-disclosure agreements" to do so.

No to mention the "we don't support Linux" bit. 8^D !!!!

I have to hand it to these chaps, they have really made an effort to look like idiots.

Best,

A.

* my nom de curmudgeon

Last edited by Altoid (Today 00:48:32)

Offline

#12 Today 00:15:08

EDX-0
Member
Registered: 2020-12-12
Posts: 187  

Re: [SOLVED] fstrim and HDDs

ah nice, gotta love western digital, they truly embody their name.

Offline

Board footer