0

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

2 Answers2

1

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
0

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?

falconer
  • 15,026
  • 3
  • 48
  • 68
  • How can we determine if a file system supports TRIM? – Anjali Raman Jan 05 '14 at 01: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 05 '14 at 10:52
  • Thanks a lot. I thought there might be some command to see whether the directory is TRIm supported. – Anjali Raman Jan 06 '14 at 17:56