# Is discard mount flag safe for my Samsung 850 Evo (1TB)?

## xicod

Hi,

Recently I've been reading that the discard flag may cause data loss on ext4 partitions for some SSD drives.

There's a popular article specifically about the 4.0 kernel (although I think this mainly refers to RAID of different sorts, which I don't use):

https://blog.algolia.com/when-solid-state-drives-are-not-that-solid/

There are even some (close to mine) Samsung models mentioned on their blacklist of misbehaving drives.

So what should I do? I have the 'discard' mount flag enabled for a month or so on several ext4 partitions (and on the swap) with no problems.

Currently I'm using the 3.18.12-gentoo kernel.

Is there any reason for me to be worried about this?

I would really appreciate if someone could shed some light on this (especially regarding my specific model of SSD)

Thanks

----------

## frostschutz

So far none save them can reproduce the issue. See the update, they even have engineers traveling to the datacenter for this.

That means no one knows exactly what the issue is in the first place. It could be a fault of the drive, of the kernel, of their configuration, or their other hardware involved (type of controller etc.).

It could be a bug that is only triggered under very obscure conditions (like partitions mis-aligned in a very specific way) or non-standard filesystem flags.

It wouldn't be the first bug in SSD firmware, so disable TRIM by all means for a few weeks until it's cleared up.

But it wouldn't be the first false duck (the vegetarian kind) either, it seems fishy because a) it affects only them and b) the damage is apparently only 512 bytes which makes not much sense for any SSD.

----------

## xicod

Thanks, I will disable discard for now, but how can I know that at some point it's fine?

Are there any bugzilla entries to follow?

----------

## mutiny

I was able to reproduce this myself. I had 2 crucial 128GB ssds in raid0 on a testing system I was playing with, with root fs on this raid0. I was on kernel 4.0.1 I think when issues occurred, with discard flag enabled on the ext4 raid0 partition. I did find there was unrecoverable data loss on some parts of the partition.

----------

## frostschutz

RAID0+TRIM had a bug in kernel 4.0.1 thereabouts. Not the fault of the SSD if the RAID layer or whatever translates TRIM commands wrong.

https://lkml.org/lkml/2015/5/21/167

----------

## bammbamm808

I have a single 840 Evo, linux 4.0.5, ext4 and trim via "discard" in fstab. No problems whatsoever here, 2 weeks in. There were resports of this, or another bug affecting single ssd setups on > 4.0.1, but it mostly seems to be the ext4/RAID0/ssd combination that causes the problems on the affected kernel versions.

----------

## s4e8

Someone predict samsung SSD delay non-NCQ TRIM execution internally, heavy rewrite may trigger ordering bug.

----------

## frostschutz

 *frostschutz wrote:*   

> So far none save them can reproduce the issue. See the update, they even have engineers traveling to the datacenter for this.

 

And I wonder what became of it... the first week the blog post got daily updates (June 1[5-9]). Engineers were supposed to arrive on June 22 but no more updates so far.

I hope that after making all this noise they'll let us know the results of their investigation (whether it was a bug in Samsung's firmware or in the Linux kernel or in their own setup).

----------

