SSD Trim automatisch ausführen

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • SSD Trim automatisch ausführen

      Ich habe soeben Trim auf meiner Dm900 SSD getestet und es wird leider nicht automatisch ausgeführt.

      Erstmal checken ob Trim unterstützt wird.

      Quellcode

      1. root@dm900:/media/hdd$ hdparm -I /dev/sda | grep -i TRIM
      2. * Data Set Management TRIM supported (limit 8 blocks)
      Trim wird unterstützt!

      Tempdatei mit Zufallswerten erzeugen.

      Quellcode

      1. root@dm900:/media/hdd$ dd if=/dev/urandom of=tempfile count=100 bs=512k
      2. 100+0 records in
      3. 100+0 records out
      4. 52428800 bytes (50.0MB) copied, 9.131726 seconds, 5.5MB/s
      Cache löschen.

      Quellcode

      1. root@dm900:/media/hdd$ sync
      2. root@dm900:/media/hdd$ sync
      Den Block rausfinden in dem die Datei beginnt.

      Quellcode

      1. root@dm900:/media/hdd$ hdparm --fibmap tempfile
      2. tempfile:
      3. filesystem blocksize 4096, begins at LBA 40; assuming 512 byte sectors.
      4. byte_offset begin_LBA end_LBA sectors
      5. 0 4559192 4559207 16
      6. 8192 5243000 5243047 48
      Den Block auslesen.

      Quellcode

      1. root@dm900:/media/hdd$ hdparm --read-sector 4559192 /dev/sda
      2. /dev/sda:
      3. reading sector 4559192: succeeded
      4. cfa7 2eb6 26ef 1286 735e 6a49 2893 e101
      5. 9f72 1f15 4cc5 9706 e3a1 42cb 07a6 b2eb
      Tempdatei und den Cache löschen.

      Quellcode

      1. root@dm900:/media/hdd$ rm tempfile
      2. root@dm900:/media/hdd$ sync
      3. root@dm900:/media/hdd$ sync
      Den Block nochmals einlesen.

      Quellcode

      1. root@dm900:/media/hdd$ hdparm --read-sector 4559192 /dev/sda
      2. /dev/sda:
      3. reading sector 4559192: succeeded
      4. cfa7 2eb6 26ef 1286 735e 6a49 2893 e101
      5. 9f72 1f15 4cc5 9706 e3a1 42cb 07a6 b2eb
      Die Daten sind noch da, d.h. Trim wurde nicht automatisch ausgeführt.


      Trim manuell ausführen.

      Quellcode

      1. root@dm900:/media/hdd$ fstrim /media/hdd

      Den Block nochmal einlesen.

      Quellcode

      1. root@dm900:/media/hdd$ hdparm --read-sector 4559192 /dev/sda
      2. /dev/sda:
      3. reading sector 4559192: succeeded
      4. 0000 0000 0000 0000 0000 0000 0000 0000
      5. 0000 0000 0000 0000 0000 0000 0000 0000
      Das manuelle Trimmen hat also funktioniert!

      Was muss ich tun damit die SSD automatisch nach dem Löschen einer Datei getrimmt wird? (wie unter Windows seit 7 und unter Ubuntu seit 12.04)

      Danke im Voraus!
    • Wie sehen die mount Optionen in der fstab aus?

      soweit ich weiß, wird automatisches trim erst ab kernel 3.2 unterstützt - bin jetzt aber nicht ganz sicher
      SSD caching ab kernel 3.9
      im aktuellen DreamOS wird der kernel 3.14 verwendet

      Aktuelle Linuxdistributionen empfehlen auch ein weekly trim statt über die discard Option in der fstab
      siehe auch wiki.debian.org/SSDOptimization
      Gruß Fred

      Die Dreambox ist tot, es lebe die Dreambox

      ¯\_(ツ)_/¯

      Quellcode

      1. root@dm920:~$ mount | grep "/ "
      2. /dev/mmcblk1p1 on / type ext4 (rw,relatime,data=ordered)
      3. root@dm920:~$
    • es war

      Quellcode

      1. /dev/disk/by-uuid/a3f74f5d-800c-4c69-bf88-6e4669d7f56g /media/hdd auto auto,nofail 0 0
      habs auf


      Quellcode

      1. /dev/disk/by-uuid/a3f74f5d-800c-4c69-bf88-6e4669d7f56g/media/hdd auto auto,nofail,discard 0 0
      geändert, ohne Erfolg.