[kwlug-disc] SMART for SSDs

B.S. bs27975 at yahoo.ca
Fri Jul 31 01:38:27 EDT 2015


>________________________________
> From: Khalid Baheyeldin <kb at 2bits.com>
>To: KWLUG discussion <kwlug-disc at kwlug.org> 
>Sent: Thursday, July 30, 2015 11:07 PM
>Subject: Re: [kwlug-disc] SMART for SSDs
> 
>
>

>In light of Samsung's SSD being exonerated in the news today(1), and a TRIM bug found in Linux, with the driver blacklisting stuff (probably incorrectly), it seems that using TRIM is not something that is a given(2)


Be fair ... article notes bug presents itself 'if the system is using linux md raid with raid0 or raid10'.

[From bug fix patch: This fixes a data corruption bug when using discard on top of MD linear,
raid0 and raid10 personalities.]

<phew!>


>So, some questions to those using SSDs:>
>a. Do you use anything that enables TRIM on your SSD?
>
>b. If so, do you add "discard" to fstab, or run fstrim from cron?
>
>c. What other mount options do you use (noatime comes to mind, relatime is the default since 2.6.something, other options)?



>From my reading when I first got my SSD, fstab has "defaults,noatime,nodiratime,discard" (ext4).

Reading further, now, http://linux.die.net/man/8/mkfs.ext3, looks like discard is the default. (discard feels trim related.) I also see that mkfs defaults come from /etc/mke2fs.conf


Topically, given meeting (btrfs) context ...

mkfs.btrfs has '--nodiscard' (Do not perform whole device TRIM operation by default.), but I can't tell on my 12.04 if it is the default. 'mkfs.btrfs -O list-all' does not work here. (BTRFS 0.19)
[https://btrfs.wiki.kernel.org/index.php/Mkfs.btrfs] My 14.04 shows BTRFS 3.12. 'mkfs.btrfs -O list-all' does work there, but the available options don't seem fascinating in my use case.

[https://btrfs.wiki.kernel.org/index.php/Main_Page] ... BTRFS feature ... "SSD (Flash storage) awareness (TRIM/Discard for reporting free blocks for reuse) and optimizations (e.g. avoiding unnecessary seek optimizations, sending writes in clusters, even if they are from unrelated files. This results in larger write operations and faster write throughput)"


btrfs now appears to also have a 'ssd' mount option. 
https://btrfs.wiki.kernel.org/index.php/FAQ#Is_Btrfs_optimized_for_SSD.3F . Interestingly, -O SSD disables trim/discard, and discard is not the default. There is also -O ssd_spread


My default take has been that better minds than mine choose default mount options, so generally go with them. Reassuring, though, is that more and more I see blurbs such as 'SSD aware', and since there is a spin rate file out there (0 for SSDs), it appears that SSD detection/awareness is present for the expertise from those minds to get applied. By default.

YMMV, of course.


A related thing I have recently come across, interesting for those of you still using 12.04 ... there is a ppa for loading/running trusty (14.04) kernels, going from something like 3.3 to 3.13. Given that the btrfs pages note significant changes and bug fixes as the kernel evolves, I suspect running the latest kernel you can is prudent. https://wiki.ubuntu.com/Kernel/LTSEnablementStack

Since it seems prudent to also update btrfs-tools, poking about revealed that 
https://launchpad.net/ubuntu/+source/btrfs-tools is out there.



>Notes:
>
>i. You can tell if your SSD supports TRIM by issuing the command: 
>
>hdparm -I /dev/sdX | grep TRIM 
>
>ii. Ubuntu 14.04 has fstrim enabled as a weekly cron, but only for Intel and Samsung SSDs.
>
>iii. Other good references in (3) and (4).
>
>(1) http://linux.slashdot.org/story/15/07/30/1814200/samsung-finds-fixes-bug-in-linux-trim-code
>
>(2) https://wiki.debian.org/SSDOptimization#WARNING
>
>(3) https://wiki.archlinux.org/index.php/Solid_State_Drives
>
>(4) https://sites.google.com/site/easylinuxtipsproject/ssd





More information about the kwlug-disc mailing list