Trim enabled by default on Mint 17.2?

mintydroid

Expert Member
Joined
Aug 8, 2013
Messages
1,872
Reaction score
2
Noob question. Is trim enabled by default under Linux Mint? I have found this under /etc/cron.weekly/fstrim. Both my linux pc's have ssd's which aren't Intel or Samsung. Here's the code. Is this sufficient?

Code:
#!/bin/sh
# call fstrim-all to trim all mounted file systems which support it set -e

# This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty 
# firmware may encounter data loss problems when running fstrim under high I/O
# load (e. g.  https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives.
exec fstrim-all
 
Noob question. Is trim enabled by default under Linux Mint? I have found this under /etc/cron.weekly/fstrim. Both my linux pc's have ssd's which aren't Intel or Samsung. Here's the code. Is this sufficient?

Code:
#!/bin/sh
# call fstrim-all to trim all mounted file systems which support it set -e

# This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty 
# firmware may encounter data loss problems when running fstrim under high I/O
# load (e. g.  https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives.
exec fstrim-all

http://lifehacker.com/5640971/check-if-trim-is-enabled-for-your-solid-state-drive-in-windows-7
 
What make are they?

What happens if you do the following?
Code:
sudo fstrim-all

I've got a Corsair 60GB LS series in one and a msata Kingston 60GB in another.

I'll try that and report back.
 
Tried sudo fstrim-all and it doesn't display any output or any error. Seems like it completes the command and moves onto the next line waiting for a new command.

Does this mean it's working correctly?

I've also tried sudo fstrim-all--no-model-check and get an error stating command not found.
 
Tried sudo fstrim-all and it doesn't display any output or any error. Seems like it completes the command and moves onto the next line waiting for a new command.
Just to be clear, you ran this command on its own, you didn't edit /etc/cron.weekly/fstrim or anything else?
Does this mean it's working correctly?
Looking at /sbin/fstrim-all , I don't think so. I would have expected it to print the names of each mountpoint it ran fstrim for, or print a warning that the device is not a drive that is known-safe for trimming.
I've also tried sudo fstrim-all--no-model-check and get an error stating command not found.
That should be ' sudo fstrim-all --no-model-check'.

On the other hand, /sbin/fstrim-all contains the following:
Code:
while read DEV MOUNT FSTYPE OPTIONS REST; do
    # only consider /dev/*
    [ "${DEV#/dev}" != "$DEV" ] || continue
    # ignore mounts with "discard", they TRIM already
    if contains "$OPTIONS" discard; then continue; fi
That sounds like if your filesystem is mounted with the discard option, then it already TRIMs.

What is the output of:
Code:
cat /etc/fstab | grep discard
 
Just to be clear, you ran this command on its own, you didn't edit /etc/cron.weekly/fstrim or anything else?

Looking at /sbin/fstrim-all , I don't think so. I would have expected it to print the names of each mountpoint it ran fstrim for, or print a warning that the device is not a drive that is known-safe for trimming.

That should be ' sudo fstrim-all --no-model-check'.

On the other hand, /sbin/fstrim-all contains the following:
Code:
while read DEV MOUNT FSTYPE OPTIONS REST; do
    # only consider /dev/*
    [ "${DEV#/dev}" != "$DEV" ] || continue
    # ignore mounts with "discard", they TRIM already
    if contains "$OPTIONS" discard; then continue; fi
That sounds like if your filesystem is mounted with the discard option, then it already TRIMs.

What is the output of:
Code:
cat /etc/fstab | grep discard

Nothing is happening just like the fstrim-all command but here's my fstab that I normally edit via Nano. Drives W1-W5 are my Samba drives which I had included.

Code:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=2df36fc6-096a-4e5e-84b3-9d7526589ebb /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=7aa8222b-6dae-4cda-8f73-32ba79a04fe5 none            swap    sw              0       0

UUID=517f3736-c3cd-43f8-9234-c5e6c9844489 /media/server/W1 ext4 defaults 0 1
UUID=83bd4a93-20bb-4bb7-a884-a1350fa3960b /media/server/W2 ext4 defaults 0 1
UUID=b9b8bbc1-a686-48ef-a115-3c25ba008e1f /media/server/W3 ext4 defaults 0 1
UUID=9389892e-89e2-4398-8c19-8853e0aeb795 /media/server/W4 ext4 defaults 0 1
UUID=9e34767d-795f-485d-bb36-37a6a1bfedbf /media/server/W5 ext4 defaults 0 1
 
Nothing is happening just like the fstrim-all command but here's my fstab that I normally edit via Nano. Drives W1-W5 are my Samba drives which I had included.
In the case of grep, no output means nothing was found. We can confirm that by looking at your /etc/fstab.

For what it is worth, here's my output:
Code:
$ cat /etc/fstab | grep discard
UUID=cbf1eecf-2408-4167-9260-f92a6bda648f / ext4 discard,noatime,nodiratime,data=ordered,errors=remount-ro 0 1
I am running Ubuntu 15.10 on an Intel 60GB SSD.
Ubuntu 15.10 no longer has the 'fstrim-all' command, it is now an option for 'fstrim', i.e. 'fstrim --all'.
Also, the device whitelist in the 'fstrim-all' command (that enabled TRIM for certain models) has been replaced by device blacklisting in the kernel (TRIM is only disabled for known dodgy drives).
 
Last edited:
What happens if you manually trim your root filesystem (/)?
Code:
sudo fstrim -v /

Does it immediately exit, or does it seem to hang for a few minutes and then print how many bytes were trimmed?

What TRIM features do your two SSDs support (assuming /dev/sda)?
Code:
sudo hdparm -I /dev/sda | grep TRIM

Output from my drive:
Code:
$ sudo hdparm -I /dev/sda | grep TRIM
	   *	Data Set Management TRIM supported (limit 1 block)
	   *	Deterministic read data after TRIM
 
Last edited:
What happens if you manually trim your root filesystem (/)?
Code:
sudo fstrim -v /

Does it immediately exit, or does it seem to hang for a few minutes and then print how many bytes were trimmed?

What TRIM features do your two SSDs support (assuming /dev/sda)?
Code:
sudo hdparm -I /dev/sda | grep TRIM

Output from my drive:
Code:
$ sudo hdparm -I /dev/sdf | grep TRIM
	   *	Data Set Management TRIM supported (limit 1 block)
	   *	Deterministic read data after TRIM

Output from sudo fstrim -v /:

Code:
/: 42402721792 bytes were trimmed

Output from sudo hdparm -I /dev/sda | grep TRIM:

Code:
Data Set Management TRIM supported (limit 8 blocks)

What should I do from here?
 
Looks good.

Looks good.

Now try:
Code:
sudo fstrim-all --no-model-check
Does it immediately exit, or does it seem to hang for a few minutes?

It immediately jumps to the next line waiting for a new command.

Edit: Tried the verbose option at the end and nothing as well.
 
Last edited:
It immediately jumps to the next line waiting for a new command.

Edit: Tried the verbose option at the end and nothing as well.
Sounds like the fstrim-all script doesn't do what it is supposed to.

If you are confident that neither of your drives have faulty firmware, you can try editing /etc/cron.weekly/fstrim as follows:
Code:
#!/bin/sh
# call fstrim-all to trim all mounted file systems which support it set -e

# This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty 
# firmware may encounter data loss problems when running fstrim under high I/O
# load (e. g.  https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives.
[b]#exec fstrim-all[/b]
[b]exec fstrim /[/b]
 
Sounds like the fstrim-all script doesn't do what it is supposed to.

If you are confident that neither of your drives have faulty firmware, you can try editing /etc/cron.weekly/fstrim as follows:
Code:
#!/bin/sh
# call fstrim-all to trim all mounted file systems which support it set -e

# This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty 
# firmware may encounter data loss problems when running fstrim under high I/O
# load (e. g.  https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives.
[b]#exec fstrim-all[/b]
[b]exec fstrim /[/b]

Will do. I was thinking my other option is to setup a startup command so it does a trim on every startup.

Thanks for your help.
 
Top
Sign up to the MyBroadband newsletter
X