TRIM Question [SOLVED]

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
crboone

TRIM Question [SOLVED]

Post by crboone »

I've been researching how to trim my SSD boot drive but am having problems making it work. First, TRIM does seem to be supported for my drive, per:

HP-Pavilion-Mini / # hdparm -I /dev/sdb | grep TRIM
* Data Set Management TRIM supported (limit 1 block)
* Deterministic read data after TRIM


But for some reason, I cannot seem to run fstrim:

HP-Pavilion-Mini / # sudo -v fstrim /
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-u user]
[VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-u user] file ...


** Could someone tell me what the correct command is for this now?


Also, if I were to add this to fstab, would I simply add "discard" to the following line (before the errors...)?

UUID=2319eb2f-9eab-454c-85a4-1dd7990bf8b1 / ext4 errors=remount-ro 0 1

or should I change it to:

UUID=[UUID of SSD mount] / ext4 defaults,noatime,discard 0 1


Thanks for any help.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Mute Ant

Re: TRIM Question

Post by Mute Ant »

Because it's COMMAND OPTIONS ARGUMENTS
Your -v option got applied to the sudo command. Try...

Code: Select all

sudo  fstrim  -v  /
...or if you are already root, miss out the sudo.

Code: Select all

fstrim -v /
/etc/fstab entries go...

Code: Select all

WHAT   WHERE   TYPE   O,P,T,I,O,N,S   0   1
...so...

Code: Select all

UUID=2319eb2f-9eab-454c-85a4-1dd7990bf8b1   /   ext4   discard,errors=remount-ro   0   1
...and...

Code: Select all

UUID=2319eb2f-9eab-454c-85a4-1dd7990bf8b1   /   ext4   errors=remount-ro,discard   0   1
...have exactly the same effect. You might like to add noatime to stop every read causing a write...

Code: Select all

UUID=2319eb2f-9eab-454c-85a4-1dd7990bf8b1   /   ext4   errors=remount-ro,discard,noatime   0   1
Last edited by Mute Ant on Sun Jun 07, 2015 7:28 pm, edited 1 time in total.
crboone

Re: TRIM Question

Post by crboone »

Yes, thank you -- I think the page that I got the command from just had a typo (it mistakenly had the -v first so I did a copy/paste of that command). Unfortunately, it doesn't work the other way either:

# sudo fstrim -v /
fstrim: /: FITRIM ioctl failed: Operation not supported

As root:

# fstrim -v /
fstrim: /: FITRIM ioctl failed: Operation not supported

Why would the hdparm indicate TRIM is supported but the fstrim operation is not supported?

I may just add the fstab options -- but I had read that wasn't as good to use (not sure why though).
Mute Ant

Re: TRIM Question

Post by Mute Ant »

''Why would the hdparm indicate TRIM is supported but the fstrim operation is not supported?'' My guess is that ''running on an external SSD'' stops 'trim' commands getting to the drive.
crboone

Re: TRIM Question

Post by crboone »

Even though the OS is running on the drive? I suppose there must be some difference, I guess.
Mute Ant

Re: TRIM Question

Post by Mute Ant »

''the OS is running on the drive?'' No, copied from the drive into RAM.
crboone

Re: TRIM Question

Post by crboone »

I found this link that supports your answer (thought it's a bit dated):

http://askubuntu.com/questions/262154/t ... -supported

I suppose this is one reason to purchase an internal SSD before too long.
crboone

Re: TRIM Question

Post by crboone »

I've installed the SSD internally and the fstrim operation does appear to be working.
Locked

Return to “Beginner Questions”