You may use it as a single drive or mixed with hard drive as a dual drive hybrid systems on Linux.
Wiki explains trim on Linux very clearly:
Initial support for discard operations was added for FTL NAND flash devices in 2.6.28. Support for the ATA Trim command was added in 2.6.33.
Not all filesystems make use of Trim. Among the filesystems that can issue Trim requests automatically are Ext4, Btrfs, FAT, GFS2 and XFS. However, this is disabled by default due to performance concerns, but can be enabled by setting the “discard” mount option. Ext3, NILFS2 and OCFS2 offer ioctls to perform offline trimming. The Trim specification calls for supporting a list of trim ranges, but as of kernel 3.0 trim is only invoked with a single range that is slower.
Therefore, use uname -a to see you Linux kernel version. Don’t forget to check if your SSD supports TRIM, too.
Noted. TRIM doesn’t work for RAID.
Verify TRIM in Linux is Enabled
How to Know if TRIM Is Working in Linux by Tiffany Garden from Demand Media explains every steps very clearly. Just run hdparm -I and looking for “discard” or “Data Set Management TRIM supported”. More detail about this command may be found in Linux Commands. QNAP need to install with ipkg install hdparm first.
Here is what I got from my notebook with SSD running Ubuntu 14.04 LTS.
~$ sudo hdparm -I /dev/sda2 | grep TRIM * Data Set Management TRIM supported (limit 1 block) * Deterministic read data after TRIM
If it is not enabled, edit your /etc/fstab file and add “discard” in options which is explained in SSD discard (trim) support on OpenSUSE SDB as below.
Discard is the linux term for telling a storage device that sectors are no longer storing valid data and applies equally to both ATA and SCSI devices. ie. For ext4 filesystems, there is a discard mount option, not a trim or unmap option.
Reboot to take effect and run mount to see if the option is used while mounting SSD partitions.
~$ sudo mount | grep root /dev/mapper/ubuntu--vg-root on / type ext4 (rw,errors=remount-ro,discard)
According to Didier (or PiroNet) in QNAP NAS Community Forum: Trim for SSDs, he quotes following words by Mark Lord on native Trim in Linux kernel to explain why you need to Trim with wiper.sh manually.
There has been a TRIM add-on for the Linux kernel (“native TRIM”) available for many months now, but it has not gone mainstream yet due to lack of real TRIM hardware for testing it.
Now that we have real TRIM hardware, that add-on has proven inadequate (slows things down way too much), so some redesign / rework is necessary before it can go mainstream.
The lead developer, Matthew Wilcox, is mulling over the design now, with contributions from myself and several other key Linux kernel people.
This process will take several months, which is why I created wiper.sh for use in the interim. Heck, one of the better longer term proposals is to stick with something like this, but with improved kernel integration/support for it.
In SSD discard (trim) support, it recommends to use wiper.sh with OpenSuSE prior to 11.4 (Linux kernel 2.3.37 according to openSUSE on Wiki) manually. Use fstrim in util-linux package with and after 11.4.
You may check Linux kernel version on you NAS in phpinfo() Reports on NAS.
Here is a sample running fstrim on my notebook. It might be different on your computer.
~$ sudo fstrim / -v /: 164952039424 bytes were trimmed
If you need to use wiper.sh, it could be download from hdparm files on SourceForge. OCZ Vertex-LE users need partition your drive excluding the last sector to avoid error. It works for read-write mounted ext4 and xfs, and for read-only mounted/unmounted ext2, ext3, ext4, reiser3, and xfs. Don’t use it with btrfs.
On How To Get wiper.sh Running On QNAP Storage Devices To TRIM SSDs?, Didier list all the steps from install packages to modify script files and includes trouble shooting.
SSD as Cache for Hybrid Drive
Like most hybrid drive or SSHD, you may use SSD and hard drive to build dual drive hybrid systems. You will need a special kernel level program to achieve this in Linux. Here is a list of your choice:
- bcache: still maintained on official website.
- dm-cache: didn’t update for more than two years on GitHub.
- Flashcache: developed by Facebook.
- EnhancedIO: a fork of Flashcache by sTec which has been acquired by HGST, a Western Digital company on Sep 12, 2013.
- Wiki: Trim (computing)
- Wiki: Hybrid drive: Dual drive hybrid systems
- QNAP: Compatibility list: SSD
- Wiki: Standard RAID levels
- QNAP NAS Community Forum: TS459 Pro+ compatibility with OCZ SSD’s and TRIM support
- QNAP NAS Community Forum: Trim for SSDs
- SmallBusiness.chron.com: How to Know if TRIM Is Working in Linux
- Linux Commands Examples: hdparm
- OpenSuSE: SDB:SSD discard (trim) support
- SourceForge: hdparm files
- QNAP NAS Community Forum: TRIMing using wiper.sh – need assistance!
- Wiki: openSUSE
- phpinfo() Reports on NAS
- DeinosCloud: How To Get wiper.sh Running On QNAP Storage Devices To TRIM SSDs?
- Wiki: Hybrid drive
- Wiki: bcache
- bcache Official Website
- Wiki: dm-cache
- GitHub: mingzhao / dm-cache
- Wiki: Flashcache
- GitHub: stec-inc / EnhancedIO: EnhancedIO Open Source fir Linux
- LWN.net: LSFMM: Caching — dm-cache and bcache