Kernel option to disable TRIM/discard system-wide?
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!
Quoted 7 lines · Peter Rabbitson
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...?
Quoted 10 lines · Peter Rabbitson
Quoted 7 lines · Peter Rabbitson
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
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Rabbitson <[email protected]> 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.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 8 lines · Martin K. Petersen
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Rabbitson <[email protected]> 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_bytesto 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?
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Rabbitson <[email protected]> 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
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering