{"id":20722,"date":"2025-10-14T10:23:10","date_gmt":"2025-10-14T08:23:10","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=20722"},"modified":"2025-11-10T08:22:21","modified_gmt":"2025-11-10T07:22:21","slug":"ssd-unter-linux-trim-befehl-notwendig","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2025\/10\/14\/ssd-unter-linux-trim-befehl-notwendig\/","title":{"rendered":"SSD unter Linux: TRIM-Befehl notwendig?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Der TRIM-Befehl bei SSD&#8217;s unter Linux ist grunds\u00e4tzlich wichtig, jedoch ist er bei modernen Linux-Distributionen meist automatisch eingerichtet. Das Betriebssystem sendet in der Regel automatisch regelm\u00e4\u00dfige TRIM-Befehle (meist w\u00f6chentlich) an die SSD, damit diese wei\u00df, welche Speicherbereiche nicht mehr gebraucht werden und daher intern gel\u00f6scht und freigegeben werden k\u00f6nnen. Das verbessert die Leistung und verl\u00e4ngert die Lebensdauer der SSD.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">TRIM-Unterst\u00fctzung und Funktionsweise unter Linux<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Der TRIM-Befehl teilt der SSD mit, welche Datenbl\u00f6cke nicht mehr in Gebrauch sind, was die interne Speicherbereinigung effizienter macht. Moderne Dateisysteme wie Ext4, Btrfs und XFS unterst\u00fctzen TRIM. Viele Linux-Distributionen aktivieren standardm\u00e4\u00dfig einen systemd-Timer (fstrim.timer), der den TRIM-Befehl periodisch automatisch ausf\u00fchrt.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Voraussetzungen<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Der Linux-Kernel unterst\u00fctzt TRIM seit Version 2.6.28. Das gilt ebenso f\u00fcr die SSD &#8211; was moderne SSD&#8217;s  in der Regel auch tun. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Pr\u00fcfung des TRIM-Supports:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo hdparm -I \/dev\/sdX | grep -i TRIM<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Dabei ist \/dev\/sdX durch die SSD ersetzen &#8211; im Beispiel also:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo hdparm -I \/dev\/sda | grep -i TRIM<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Das Ergebnis der Ausgabe &#8211; wie vermutet &#8211; TRIM wird unterst\u00fctzt&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_3.jpg\" rel=\"lightbox-0\"><img loading=\"lazy\" decoding=\"async\" width=\"761\" height=\"138\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_3.jpg\" alt=\"\" class=\"wp-image-20725\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_3.jpg 761w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_3-150x27.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_3-300x54.jpg 300w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/a><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">TRIM manuell ausf\u00fchren<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Das Tool fstrim (Teil von util-linux) kann manuell ausgef\u00fchrt werden:<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code>sudo fstrim -av<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Dies trimmt alle eingeh\u00e4ngten Dateisysteme, die TRIM unterst\u00fctzen&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"728\" height=\"134\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_4.jpg\" alt=\"\" class=\"wp-image-20727\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_4.jpg 728w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_4-150x28.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_4-300x55.jpg 300w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Automatische TRIM Ausf\u00fchrung \u00fcber systemd-Unit<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Linux bietet eine systemd-Timer-Einheit <em>fstrim.timer<\/em>, die w\u00f6chentlich einmal <em>fstrim.service<\/em><br>startet und somit TRIM regelm\u00e4\u00dfig aktiviert ohne manuellen Aufwand. Es empfiehlt sich, diese<br>automatische Methode zu verwenden, da sie SSD-Schonender ist als die discard-Mountoption.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Aktivierung des Timer:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code>sudo systemctl enable --now fstrim.timer<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Dies startet den Timer sofort und aktiviert ihn dauerhaft.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Status pr\u00fcfen:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code>systemctl status fstrim.timer<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_5.jpg\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" width=\"990\" height=\"280\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_5.jpg\" alt=\"\" class=\"wp-image-20728\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_5.jpg 990w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_5-150x42.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_5-300x85.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_5-768x217.jpg 768w\" sizes=\"auto, (max-width: 990px) 100vw, 990px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hier sieht man, ob der Timer aktiv ist und wann er das n\u00e4chste Mal l\u00e4uft.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>N\u00e4chsten geplanten Lauf anzeigen:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code>systemctl list-timers fstrim.timer<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_6.jpg\" rel=\"lightbox-2\"><img loading=\"lazy\" decoding=\"async\" width=\"997\" height=\"241\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_6.jpg\" alt=\"\" class=\"wp-image-20729\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_6.jpg 997w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_6-150x36.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_6-300x73.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_6-768x186.jpg 768w\" sizes=\"auto, (max-width: 997px) 100vw, 997px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Der n\u00e4chste TRIM-Vorgang startet also laut Ausgabe am 20.10.2025 um 14:51:03 Uhr. Alles OK.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Letzten TRIM-Vorgang einsehen:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code>journalctl -u fstrim.service<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_7.jpg\" rel=\"lightbox-3\"><img loading=\"lazy\" decoding=\"async\" width=\"999\" height=\"180\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_7.jpg\" alt=\"\" class=\"wp-image-20730\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_7.jpg 999w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_7-150x27.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_7-300x54.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2025\/10\/ssd_7-768x138.jpg 768w\" sizes=\"auto, (max-width: 999px) 100vw, 999px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hier weist die Ausgabe ebenfalls einen korrekten Vorgang aus.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Unterschiede bei TRIM f\u00fcr NVMe und SATA<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SATA-SSD&#8217;s verwenden den ATA-Befehlssatz, und TRIM ist hier ein ATA-Befehl. NVMe hingegen verwendet den NVMe-Befehlssatz, in dem Funktionen wie DEALLOCATE und WRITE ZEROS mit DEALLOCATE-Hinweisbit TRIM-\u00e4hnliche Aufgaben erledigen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NVMe-SSDs unterst\u00fctzen TRIM durch ein moderneres und effizienteres Protokoll, was bei SATA nicht der Fall ist.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Trotzdem l\u00e4uft das Linux-System in der Regel mit einem einheitlichen TRIM-Mechanismus, der \u00fcber fstrim.timer regelm\u00e4\u00dfig TRIM-Befehle an alle unterst\u00fctzten SSD&#8217;s sendet, unabh\u00e4ngig ob NVMe oder SATA.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Fazit<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">TRIM ist unter Linux f\u00fcr SSD&#8217;s essenziell, um die Leistung zu erhalten und die Lebensdauer zu verl\u00e4ngern. Moderne Linux-Systeme aktivieren TRIM meist automatisch mit einem periodischen Befehl, der w\u00f6chentlich nicht mehr genutzte Speicherbereiche der SSD freigibt. Insgesamt empfiehlt sich bei aktuellen Linux-Distributionen, die automatische periodische TRIM-Ausf\u00fchrung aktiviert zu lassen und ansonsten keine manuelle oder getrennte Konfiguration vorzunehmen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Bildquellen: Privates Archiv<\/p>\n<div class=\"pld-like-dislike-wrap pld-custom\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir\" data-post-id=\"20722\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Hoch.png\" alt=\"Gef\u00e4llt mir\" \/>\r\n            <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">18    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir nicht\" data-post-id=\"20722\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Runter.png\" alt=\"Gef\u00e4llt mir nicht\" \/>\r\n            <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Der TRIM-Befehl bei SSD&#8217;s unter Linux ist grunds\u00e4tzlich wichtig, jedoch ist er bei modernen Linux-Distributionen meist automatisch eingerichtet. Das Betriebssystem sendet in der Regel automatisch regelm\u00e4\u00dfige TRIM-Befehle (meist w\u00f6chentlich) an die SSD, damit diese wei\u00df, welche Speicherbereiche nicht mehr gebraucht werden und daher intern gel\u00f6scht und freigegeben werden k\u00f6nnen. Das verbessert die Leistung und verl\u00e4ngert [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":20737,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[539,1443,17],"tags":[1417,1416,1415],"class_list":["post-20722","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dienstprogramme","category-grundlagen","category-system","tag-nvme","tag-ssd","tag-trim"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/20722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=20722"}],"version-history":[{"count":5,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/20722\/revisions"}],"predecessor-version":[{"id":20734,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/20722\/revisions\/20734"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/20737"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=20722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=20722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=20722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}