TRIM Question [SOLVED]

All Gurus once were Newbies
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. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
crboone
Level 1
Level 1
Posts: 29
Joined: Mon May 27, 2013 12:21 pm

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 crboone on Mon Jun 08, 2015 11:57 pm, edited 3 times in total.

Mute Ant
Level 14
Level 14
Posts: 5132
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

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.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

crboone
Level 1
Level 1
Posts: 29
Joined: Mon May 27, 2013 12:21 pm

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
Level 14
Level 14
Posts: 5132
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

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.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

crboone
Level 1
Level 1
Posts: 29
Joined: Mon May 27, 2013 12:21 pm

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
Level 14
Level 14
Posts: 5132
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: TRIM Question

Post by Mute Ant »

''the OS is running on the drive?'' No, copied from the drive into RAM.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

crboone
Level 1
Level 1
Posts: 29
Joined: Mon May 27, 2013 12:21 pm

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
Level 1
Level 1
Posts: 29
Joined: Mon May 27, 2013 12:21 pm

Re: TRIM Question

Post by crboone »

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

Post Reply

Return to “Newbie Questions”