Samsung 840 EVO: Latest Firmware Breaks fstrim... A Possible Solution...

Just a quick note for any Linux users who have a Samsung 840 EVO SSD:

If you fall into that category, then you probably know that Samsung issued a firmware update last week in order to fix (once and for all?) the 840 EVO’s long-standing performance issues. You probably also know that installing this update can lead to substantial unpleasantness, because it disables (under Linux) the ability to TRIM your drive. Both fstrim and the ‘discard’ mount option seem to be affected (check this bug report), causing boot problems or, at the very least, long term performance degradation…

This is rubbish, so I had a look around and discovered the Linux version of Samsung’s ‘Magician’ software – and found that it has its own inbuilt TRIM functionality. And guess what? Even with the latest firmware, it seems to work just fine.

So if you’re suffering with your 840 EVO, I suggest you try the following:

(Disclaimer: I don’t know how/why this works, or if it will blow up your computer, but so far I’ve had no problems. I’m not responsible if something bad happens…)

Remove the ‘discard’ option for any 840 EVO partitions in your ‘/etc/fstab’, and delete any cron jobs that run fstrim. If you normally run fstrim at boot (and not via cron), remove the command from ‘/etc/rc.d/boot.local’ (or wherever else you might have put it). Your Linux install should now be fairly safe and stable…

Now download ‘Samsung SSD Magician DC’ and ‘install’ it like so:

$ tar -xvzf samsung_magician_dc-v1.0_rtm_p2.tar.gz
$ sudo mv samsung_magician_dc-v1.0_rtm_p2/ /opt/

Run the tool as follows in order to get the disk number of your 840 EVO:

$ sudo /opt/samsung_magician_dc-v1.0_rtm_p2/64bin/magician -L

(NB: if you have a 32bit system, replace ‘64bin’ with ‘32bin’)

You should get something like this:

================================================================================================
Samsung(R) SSD Magician DC Version 1.0
Copyright (c) 2014 Samsung Corporation
================================================================================================
----------------------------------------------------------------------------------------------------
| Disk   | Model                    | Serial         | Firmware  | Capacity | Drive  | Total Bytes |
| Number |                          | Number         |           |          | Health | Written     |
----------------------------------------------------------------------------------------------------
| 0      |Samsung SSD 840 EVO 120GB |xxxxxxxxxxxxxxx |EXT0DB6Q   | 111 GB   | GOOD   | 0.10 TB     |
----------------------------------------------------------------------------------------------------
| 1      |Samsung SSD 840 EVO 250GB |xxxxxxxxxxxxxxx |EXT0DB6Q   | 232 GB   | GOOD   | 0.25 TB     |
----------------------------------------------------------------------------------------------------

If you only have one 840 EVO, then it should be disk number 0.

You can now perform a manual TRIM operation using the command:

$ sudo /opt/samsung_magician_dc-v1.0_rtm_p2/64bin/magician -d <disk number> -T

So for the first disk in my system, that would be:

$ sudo /opt/samsung_magician_dc-v1.0_rtm_p2/64bin/magician -d 0 -T

which produces:

================================================================================================
Samsung(R) SSD Magician DC Version 1.0
Copyright (c) 2014 Samsung Corporation
================================================================================================
Do you want to continue with Optimization (yes to continue):yes
------------------------------------------------------------------------------------------------
Disk Number:  0 | Model Name: Samsung SSD 840 EVO 120GB | Firmware Version: EXT0DB6Q
------------------------------------------------------------------------------------------------
TRIM:  [INFO] Optimizing Volume --> /dev/sda2 
TRIM:  [INFO] Optimizing Volume --> /dev/sda3 
TRIM:  TRIM operation is completed.  
------------------------------------------------------------------------------------------------
Completed [  100% ] 
------------------------------------------------------------------------------------------------

No errors, no problems, no system instability. (At least on my computer…)

Finally, if you want run this TRIM at boot then open ‘/etc/rc.d/boot.local’:

$ sudo nano -w /etc/rc.d/boot.local

and add the following lines:

# TRIM SSD
/opt/samsung_magician_dc-v1.0_rtm_p2/64bin/magician -d 0 -T --force

And there you have it. I can confirm that this works for me under OpenSUSE 13.1. Your mileage may vary.

I hope this helps someone…

(PS: Whenever you run ‘magician’, it produces an empty file called ‘NULL’ in the directory from which you executed the command. This file seems to be harmless, and can be safely deleted/ignored)