How to Implement Trim on SSD Drives


Recommended Posts

I can't seem to find this article. Your Google-Foo is better than mine (or you're more patient :)). Any chance someone could link to the specific article svp?

This is the one I was originally referring to, specifically with the Samsung 840 EVO:

 

http://www.xbitlabs.com/articles/storage/display/samsung-840-evo_6.html

 

 

 

Thanks!

 

I wonder what a longer wait time would yield. The review waits 30minutes before retesting. If garbage collection had longer periods of time to operate, would it result in better increases in performance?

Link to comment

I think I may have found some evidence of why I can't seem to get fstrim to work when attached to my M1015 in IT mode:

 

http://comments.gmane.org/gmane.linux.scsi/88189

 

Essentially this is saying that LSI controllers require "deterministic read after trim" capability on the SSD drive in order to enable TRIM support.  hdparm -I shows that my 850 EVO is missing support for this feature, but apparently the PRO versions have it.  I guess its just my luck that I picked out a cache drive that doesn't work with TRIM with my hardware setup.

 

Edit: Just to check I updated the firmware on the mobo and M1015.  fstrim absolutely doesn't work with this SSD on the HBA.  Oh well.

Link to comment

Well, yet another datapoint.  I removed the SSD from the M1015 and did a RDM of the SSD from a mobo SATA port.  fstrim still doesn't work.  So now I'm thinking its ESXi that might be getting in the way.  No trim for me.

 

I can verify it does not work on my ESXI m1015 either.  :/

Link to comment
  • 2 months later...

Note that virtually all modern SSDs work just fine even without OS TRIM support => as long as they have sufficient "idle" time (i.e. aren't being otherwise used but are powered on) the garbage collection algorithms in the firmware will effectively "self-TRIM" the drives.

 

Since most UnRAID systems have a large amount of "idle time" this shouldn't be an issue.

 

Link to comment

Since most UnRAID systems have a large amount of "idle time" this shouldn't be an issue.

 

I can think of one instance where there may not be sufficient idle time, and that's Plex. Plex is chatty enough on a cache disk to keep it from ever spinning down (a platter based drive of course) with a 30 minute spin down delay.

Link to comment
  • 3 weeks later...
  • 3 weeks later...

Has this been implemented into 6.0 final?

 

I'd like to know the answer to this question as well!  Lots of people are currently using SSDs in their cache so is it fair to assume that this trim stuff is a non-issue now with v6.0.1?

Link to comment

This is an item on our 'todo' list to add fstrim scheduler item.  Mounting with 'discard' option is not a very good solution since it can cause operations such as adding/removing devices to a pool take a looooong time, as well as 'mount' itself.

 

Note that if you have SSD's in the parity-protected array and run an 'fstrim' on the corresponding 'md' device it may cause parity corruption and is not recommended until we can address this.

Link to comment
  • 2 weeks later...

Maybe it goes without saying for others, but it wasn't obvious to me...

Trim wont work on your cache drive if it is formatted as reiserfs.  I have upgraded from v5 and not yet er reformatted my cache drive.  I was getting:

root@Tower:/mnt# /sbin/fstrim -v /mnt/cache/ | logger
fstrim: /mnt/cache/: FITRIM ioctl failed: Inappropriate ioctl for device
root@Tower:/mnt# df -T
Filesystem     Type        1K-blocks        Used  Available Use% Mounted on
tmpfs          tmpfs          131072       79440      51632  61% /var/log
/dev/sda       vfat         15137792     1843424   13294368  13% /boot
/dev/sdb1      ext2         59058092    29936144   26121952  54% /mnt/myapps
/dev/md2       xfs        3905110812  3337872796  567238016  86% /mnt/disk2
/dev/md3       xfs        3905110812  3841775564   63335248  99% /mnt/disk3
/dev/md4       reiserfs   2930177100  2674140732  256036368  92% /mnt/disk4
/dev/md5       reiserfs   2930177100  2725743564  204433536  94% /mnt/disk5
/dev/md6       xfs        3905110812  3780511556  124599256  97% /mnt/disk6
/dev/sdc1      reiserfs    117217208    17759172   99458036  16% /mnt/cache
shfs           fuse.shfs 20504522376 16368851696 4135670680  80% /mnt/user0
shfs           fuse.shfs 20621739584 16386610868 4235128716  80% /mnt/user
/dev/loop0     btrfs        10485760     1563720    6955000  19% /var/lib/docker
/dev/md1       xfs        2928835740     8807484 2920028256   1% /mnt/disk1

Link to comment

The method shown in the OP still works, but if you want to use the features of unRAID 6 a bit more and not risk messing up your Go file, you can put the command in a .cron file and store it on your flash under the plugins directory. This way you can avoid messing with the Go file at all.

Link to comment
  • 2 months later...
  • 2 weeks later...
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.