public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
* Kernel option to disable TRIM/discard system-wide?
@ 2016-05-23 21:01 Peter Rabbitson
  2016-05-25 13:02 ` Peter Rabbitson
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Rabbitson @ 2016-05-23 21:01 UTC (permalink / raw)
  To: linux-ide

Hello!

I have looked through the archives, but can not find anything even 
remotely related to the subject:

I want to disable trim on my system for good - yet there seems to be no 
kernel boot parameter for this.

My rationale is simple: I want best data integrity guarantees, followed 
by better battery-life + mechanical robustness (I throw my laptop around 
a lot), and only last am I concerned about performance.

There seem to be a new TRIM-related bug discovered every couple months 
for quite some time now. Combined with the "metadata leak via dm-crypt" 
makes it a no-brainer decision that I want to avoid TRIM system-wide.

I currently have my sytsem configured properly, but I am concerned a 
future OS upgrade will introduce some well meaning cron-job or something 
along these lines that will re-enable discards without me ever noticing.

Is there a boot parameter I can hard-code for forward-compatible peace 
of mind?

Thank you!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kernel option to disable TRIM/discard system-wide?
  2016-05-23 21:01 Kernel option to disable TRIM/discard system-wide? Peter Rabbitson
@ 2016-05-25 13:02 ` Peter Rabbitson
  2016-05-26 20:46   ` Jeff Moyer
  2016-05-27  2:52   ` Martin K. Petersen
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Rabbitson @ 2016-05-25 13:02 UTC (permalink / raw)
  To: linux-ide

On 05/23/2016 11:01 PM, Peter Rabbitson wrote:
> Hello!
>
> I have looked through the archives, but can not find anything even
> remotely related to the subject:
>
> I want to disable trim on my system for good - yet there seems to be no
> kernel boot parameter for this.

Any takers? Perhaps I am not asking on the correct list...?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kernel option to disable TRIM/discard system-wide?
  2016-05-25 13:02 ` Peter Rabbitson
@ 2016-05-26 20:46   ` Jeff Moyer
  2016-05-27  2:52   ` Martin K. Petersen
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff Moyer @ 2016-05-26 20:46 UTC (permalink / raw)
  To: Peter Rabbitson; +Cc: linux-ide

Peter Rabbitson <rabbit+list@rabbit.us> writes:

> On 05/23/2016 11:01 PM, Peter Rabbitson wrote:
>> Hello!
>>
>> I have looked through the archives, but can not find anything even
>> remotely related to the subject:
>>
>> I want to disable trim on my system for good - yet there seems to be no
>> kernel boot parameter for this.
>
> Any takers? Perhaps I am not asking on the correct list...?

Try CC-ing linux-kernel, linux-block and linux-scsi.

Cheers,
Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kernel option to disable TRIM/discard system-wide?
  2016-05-25 13:02 ` Peter Rabbitson
  2016-05-26 20:46   ` Jeff Moyer
@ 2016-05-27  2:52   ` Martin K. Petersen
  2016-05-29 16:25     ` Peter Rabbitson
  1 sibling, 1 reply; 6+ messages in thread
From: Martin K. Petersen @ 2016-05-27  2:52 UTC (permalink / raw)
  To: Peter Rabbitson; +Cc: linux-ide

>>>>> "Peter" == Peter Rabbitson <rabbit+list@rabbit.us> writes:

>> I want to disable trim on my system for good - yet there seems to be
>> no kernel boot parameter for this.

There's no global way to disable TRIM but you can disable it on a
per-device basis by setting /sys/block/sdN/queue/discard_max_bytes to
0. You can force queued TRIM off with noncqtrim if that makes you feel
better. However, we haven't blacklisted any drives due to TRIM problems
in about a year.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kernel option to disable TRIM/discard system-wide?
  2016-05-27  2:52   ` Martin K. Petersen
@ 2016-05-29 16:25     ` Peter Rabbitson
  2016-06-01  3:05       ` Martin K. Petersen
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Rabbitson @ 2016-05-29 16:25 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: linux-ide

On 05/27/2016 04:52 AM, Martin K. Petersen wrote:
>>>>>> "Peter" == Peter Rabbitson <rabbit+list@rabbit.us> writes:
>
>>> I want to disable trim on my system for good - yet there seems to be
>>> no kernel boot parameter for this.
>
> There's no global way to disable TRIM but you can disable it on a
> per-device basis by setting /sys/block/sdN/queue/discard_max_bytes to
> 0.

That would be sufficient for me - I can enforce this with a udev rule.

However what you propose does not currently work:

root@Ahasver:~# cat /sys/block/sda/queue/discard_max_bytes
2147450880

root@Ahasver:~# echo 0 > /sys/block/sda/queue/discard_max_bytes
-bash: /sys/block/sda/queue/discard_max_bytes: Permission denied

root@Ahasver:~# uname -a
Linux Ahasver 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u4 
(2016-02-29) x86_64 GNU/Linux

root@Ahasver:~# dpkg -l linux-image-3.16.0-4-amd64 | grep ii
ii  linux-image-3.16.0-4-amd64 3.16.7-ckt20-1+deb8u4 amd64        Linux 
3.16 for 64-bit PCs

What am I missing?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Kernel option to disable TRIM/discard system-wide?
  2016-05-29 16:25     ` Peter Rabbitson
@ 2016-06-01  3:05       ` Martin K. Petersen
  0 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2016-06-01  3:05 UTC (permalink / raw)
  To: Peter Rabbitson; +Cc: Martin K. Petersen, linux-ide

>>>>> "Peter" == Peter Rabbitson <rabbit+list@rabbit.us> writes:

Peter> root@Ahasver:~# echo 0 > /sys/block/sda/queue/discard_max_bytes
Peter> -bash: /sys/block/sda/queue/discard_max_bytes: Permission denied

Peter> What am I missing?

Your kernel is too old. Try:

echo -n disabled > /sys/block/sda/device/scsi_disk/*/provisioning_mode

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-01  3:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-23 21:01 Kernel option to disable TRIM/discard system-wide? Peter Rabbitson
2016-05-25 13:02 ` Peter Rabbitson
2016-05-26 20:46   ` Jeff Moyer
2016-05-27  2:52   ` Martin K. Petersen
2016-05-29 16:25     ` Peter Rabbitson
2016-06-01  3:05       ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox