Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to use the fstrim command on my machine. The configuration is as follows :

ubuntu@ip-172-16-10-56:~/test$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.10
Release:    12.10
Codename:   quantal

And I have created the fstrim in the /etc/cron.daily using the following commands:

sudo root vi /etc/cron.daily/fstrim

And fstrim file contains :

#! /bin/sh  

# By default we assume only / is on an SSD. 
# You can add more SSD mount points, separated by spaces.
# Make sure all mount points are within the quotes. For example:
# SSD_MOUNT_POINTS='/ /boot /home /media/my_other_ssd'  

SSD_MOUNT_POINTS='/mnt'  

for mount_point in $SSD_MOUNT_POINTS
do  
    fstrim $mount_point  
done

and then saved it and tried to run it using the command:

ubuntu@ip-172-16-10-56:/etc/cron.daily$ sudo /etc/cron.daily/fstrim 
fstrim: /mnt: FITRIM ioctl failed: Operation not supported

I get that error everytime. I am not sure what is it that I am doing wrong.

I am following the instructions mentioned in How to enable TRIM?

Any help will be greatly appreciated.

Thanks Anjali

share|improve this question

2 Answers 2

You appear to be trying to trim /mnt is something mounted as /mnt ? usually people use /mnt/myPartationName most likely defined in /etc/fstab


If you are only using a single partition and you are running on a SSD change this:
SSD_MOUNT_POINTS='/mnt'
to this:
SSD_MOUNT_POINTS='/'
If that is the case you could just put fstrim / as your cron job instead of that entire script like this
#!/bin/sh
fstrim /

Here is a SSD guide: https://sites.google.com/site/easylinuxtipsproject/ssd

share|improve this answer

You are likely trying to TRIM a file system which doesn't have TRIM support under linux. You can't do anything with that. What type of filesystem are you trying to TRIM?

share|improve this answer
    
How can we determine if a file system supports TRIM? –  Anjali Raman Jan 5 at 1:48
    
@AnjaliRaman You try to trim it, and if it reports that operation not supported then it is not supported. Under linux the following file systems support TRIM: Ext4, Ext3, Btrfs, FAT, GFS2, XFS, NILFS2 and OCFS2. (AFAIK) –  falconer Jan 5 at 10:52
    
Thanks a lot. I thought there might be some command to see whether the directory is TRIm supported. –  Anjali Raman Jan 6 at 17:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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