1

I have a SanDisk SSD P4 32GB and I use ext4. Ubuntu 14.04.

I read that I should execute the trim command from time to time, however, this command doesn't work on my machine:

# LANGUAGE=en_US:en fstrim /
fstrim: /: FITRIM ioctl failed: Operation not supported

I already have discard mount option, but my other computer with OpenSUSE took 30 minutes when asked to fstrim for the first time, suggesting discard option did not function since installation 6 months ago. I intend to trim my Ubuntu machine too to see whether discard worked.

I googled for 30 minutes. All "answers" either say you should upgrade to ext4 or you should use root and OP says "Oh it then works thanks.". I already did both.

  • I don't use the discard option, I just use fstrim on every boot. (I'll probably change that to a monthly cron job). Remove the discard option and try again, does it work ? Is your drive encrypted ? – hatterman Aug 14 '14 at 17:13
  • After removing the discard option, reboot and type at the command line 'fstrim -v /' what happens ? – hatterman Aug 14 '14 at 17:20
  • Is trim actually supported by your SSD ? Type 'sudo hdparm -I /dev/sda | grep TRIM'. (assuming sda is your drive). Is there a line saying that TRIM is supported ? You can also run fstrim without checking this by typing 'fstrim -v / --no-model-check'. As always, it is up to you to backup your data before you try any of this ! – hatterman Aug 14 '14 at 17:26
2

Is trim actually supported by your SSD ? Type

sudo hdparm -I /dev/sda | grep TRIM

(assuming sda is your drive).

Is there a line saying that TRIM is supported ?

  • 1
    I found it true. It turns out my this SSD does not have TRIM feature. I always try to persude people avoid using passive form in output message. For example: "Operation not supported", is without subject. One assumes the missing subject the speaker himself, hence it means "This command does not support this operation", while in fact it means "This device does not support this operation". He may even think OS doesn't have the module for it, while the utility author meant "This (SSD) device does not support the operation". – Tankman六四 Aug 15 '14 at 23:45
3

If you are using LVM and/or LUKS, then you need to:

  • add the discard option in your /etc/crypttab and /etc/fstab
  • set issue_discards = 1 in your /etc/lvm/lvm.conf
  • rebuild your initramfs
  • then reboot

(source)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.