44 thoughts on “SSD TRIM check tool

  1. Vadim

    TRIM check v0.4 – Written by Vladimir Panteleev
    https://github.com/CyberShadow/trimcheck

    USAGE: Place this program file on the same drive
    you’d like to test TRIM on, and run it.

    Press Enter to test drive i:…

    Querying i:\ disk space and sector size information…
    i:\ has 512 bytes per sector, and 128 sectors per cluster.
    Error: Unsupported cluster size (512*128), please report this.

    Press Enter to exit…

    Reply
    1. SoNic67

      Your little gem helped me a lot!
      I have a nForce 750i based motherboard, with SSD and Windows 7 x64. Always the fsutil command was reporting “0” – that blogs everywhere say it means TRIM functional. But I did noticed my system slowing down in time.
      Well, using your software on my laptop (intel chipset) and my nForce desktop yielded two results – on laptop it was OK, on nForce it was reporting that TRIM did not work. I tried different nForce drivers – none worked, even if all where reporting “0” at fsutil interrogation.
      Well, I replaced the nForce drivers with Microsoft “Standard Dual Channel PCI IDE” drivers and finally… TRIM worked!

      Thanks for sharing your idea and software!

      Reply
    2. ssdtest

      I’m using the TrimCheck tool to test trim on an SSD that AES256 encryption capability. The tool always responds back with INDETERMINANT result. Is this expected? I’m guessing even if the SSD controller zeroed out the NAND flash (at the trimmed location), the trimcheck tool wouldn’t read back zeroes due to encryption.

      I would appreciate your feedback.

      Reply
    3. Peter Smith

      I am using a 500GB Samsung M.2 NVMe SSE in my Windows 10 (Version 1703, (64-bit) desktop. Trimcheck indicates trim is NOT enabled. Running FUTIL to set trim has no effect. The latest Samsung Magician software states that Trim is enabled. I have contacted Samsung Support. Their technician says “if Samsung Magician reports “Trim Enabled”, then it is enabled and functioning. So, what is the situation regarding my SSD’s Trim status? (Hard Disk Sentinel does not report on the trim status of my SSD)

      Reply
      1. Vladimir Panteleev Post author

        It is possible that the drive’s condition for activating TRIM differs. If you’ve tried rebooting and waiting an extensive period of time (or explicitly triggering a TRIM through Windows or Samsung’s software) before re-running trimcheck, and it still reports as not working, then it probably is not working.

        It’s not impossible that this drive implement TRIM differently, in a way that keeps the data readable after TRIM (i.e. marking the block as trimmed so that it will be wholly erased before the next write), but I would not consider this conjecture likely unless it’s corroborated by multiple third parties.

        Reply
        1. CyberShadow Post author

          Nothing special about that. Unless the drive uses a pseudo-random pattern for trimmed data, a program simply wrote to the same place on disk that the test data was. Try closing all programs and background processes before running TrimCheck.

          Reply
  2. theoak

    Querying C:\ disk space and sector size information … C:\ has 512 bytes per sector, and 8 sectors per cluster. 46142499 out of 62435583 are free.
    Error: Disk space is too low!

    Reply
  3. theoak

    Never mind. I was running Samsung’s manual Trim at the same time. I thought it was finished. All seems to work.

    Reply
  4. Pingback: Can't get raid 0 working on my ssd's - Hardware Canucks

  5. Kenji

    I got error that “Error: The Logical Cluster Number of extent 209 is not set. Perhaps the file is
    compressed?” I run it at a virtual machine as VMWARE WORKSTATION. The .vmdk file resides on a SSD.
    I’m going to test with Hyper-V VM with .vhdx on SSD as well. Does it supoort any virtual machine environment?

    Reply
    1. Vladimir Panteleev Post author

      I strongly doubt TRIM will work inside any VM that maps its virtual HDD to a file on the host machine.

      Not sure why you’re seeing that error, though. VM disk files could be sparse, but I don’t see why that would affect behavior inside the VM.

      Reply
        1. Vladimir Panteleev Post author

          Well, what’s going on is that the OS is not reporting mapped sectors to portions of the file. This is happening on the partition level (hence LCNs – Logical Cluster Numbers), not even disk level. If you’re seeing that error in a VM, and the partition / OS doesn’t have settings to automatically make any new files compressed or sparse, my guess is that either the VM is not using a virtual HDD (it could be using something like a virtual network drive, or some other device that operates on the level of files, not clusters), or that the VM helper software (VMware Tools or whatnot) is “cheating” by injecting itself between the OS NTFS driver and the program layer.

          Reply
          1. Kenji

            Hi, Vladmir,
            Just in case, I put other messages from the tool.

            TRIM check v0.4 – Written by Vladimir Panteleev
            https://github.com/CyberShadow/trimcheck

            USAGE: Place this program file on the same drive
            you’d like to test TRIM on, and run it.

            Press Enter to test drive C:…

            Querying C:\ disk space and sector size information…
            C:\ has 512 bytes per sector, and 8 sectors per cluster.
            1261462 out of 15702527 sectors are free.
            Generating random target data block (16384 bytes)…
            First 16 bytes: 67 18 B7 D6 62 8A 37 0B B9 DE 2D 48 CC 6D 6E 5F…
            Creating C:\Users\hymag-vm1\Desktop\TRIM\trimcheck.bin…
            Querying file final paths…
            DOS : \\?\C:\Users\hymag-vm1\Desktop\TRIM\trimcheck.bin
            GUID : \\?\Volume{b86e48cd-1efd-11e1-b0c4-806e6f6e6963}\Users\hymag-vm1\Desktop
            \TRIM\trimcheck.bin
            NT : \Device\HarddiskVolume2\Users\hymag-vm1\Desktop\TRIM\trimcheck.bin
            NONE : \Users\hymag-vm1\Desktop\TRIM\trimcheck.bin
            Generating random garbage data block (1MB)…
            Writing data (16384 bytes) and padding (2x 33554432 bytes)…
            Flushing file…
            Checking file size…
            Data is located at Virtual Cluster Numbers 8192-8195 within file.
            Querying file physical location…
            trimcheck.bin has 257 extents:
            Extent 0: Virtual clusters 0-191 are located at LCN 2684072
            Extent 1: Virtual clusters 192-207 are located at LCN 5235963
            …Omitted…
            Extent 92: Virtual clusters 8096-8191 are located at LCN 11374583
            Extent 93: Virtual clusters 8192-8207 are located at LCN 5554306
            (this is the extent containing our data)
            Extent 94: Virtual clusters 8208-8255 are located at LCN 11374695
            Extent 95: Virtual clusters 8256-8271 are located at LCN 5539940
            ..omitted..
            Extent 245: Virtual clusters 16144-16271 are located at LCN 14530361
            Extent 246: Virtual clusters 16272-16388 are located at LCN 13988612
            Extent 247: Virtual clusters 16389-16399 are located at LCN -1
            Extent 248: Virtual clusters 16400-16527 are located at LCN 13987880
            Extent 249: Virtual clusters 16528-16655 are located at LCN 13985368
            ..omitted..
            Extent 255: Virtual clusters 17296-17351 are located at LCN 14230006
            Extent 256: Virtual clusters 17352-17359 are located at LCN -1
            Error: The Logical Cluster Number of extent 247 is not set. Perhaps the file is
            compressed?

            Press Enter to exit…

            Anyway, I’m going to test with Hyper-V VM on .vhdx (on SSD).
            I expect I get different situation. And I think this tool is the most important tool, because OS venders do not provide any tools for this purpose. “fsutil behavior query DisableDeleteNotify”
            is not confirmation tool for working or not. We can not see trim activity for individual users and PC installations.
            Thanks.

            Reply
            1. Vladimir Panteleev Post author

              257 extents? Wow, that virtual hard drive must be really fragmented. I’m even more puzzled at how arbitrary the distribution of VCNs with no corresponding LCNs seems.

              By the way, TrimCheck will not be able to tell you if the host OS is passing the TRIM command to the physical SSD. But it might work (in theory) to check if virtualizing TRIM works, as demonstrated in that video.

              I just looked around, and noticed Windows Server 2012 introduced block-level deduplication to NTFS. Could you check if that’s enabled for your VM guest? TrimCheck is currently writing the same 1MB of garbage, so if the OS is deduplicating the blocks, that might explain the unallocated LCNs.

  6. Pingback: Code signing | CyberShadow’s blog

  7. Pingback: LaCie's 2big Thunderbolt 2 and Rugged Thunderbolt DAS Review - News Round | News Round

  8. Frank

    Hi Vladimir ,

    Thank you for the useful tool.
    Could you provide 64-bit version of trimcheck?
    The story is:
    I have a Windows XP laptop. XP doesn’t support trim. I want to back up the system to other place and use Windows 7 setup disc to format the disk so the disk can be trimmed. I only have 64-bit Windows 7 disc. Windows 7 setup program doesn’t support WOW64 so any program run under the program must be 64-bit program. (One can press Shift – F10 to launch command line.)

    I try to build 64-bit trimcheck myself but failed.
    It seems a path problem:
    C:\Users\Frank\Documents\Visual Studio 2012\Projects\trimcheck-master\trimcheck-
    master>rdmd –build-only trimcheck
    trimcheck.d(29): Error: module windows is in file ‘win32\windows.d’ which cannot
    be read
    import path[0] = .
    import path[1] = C:\D\dmd2\windows\bin\..\..\src\phobos
    import path[2] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
    Failed: [“dmd”, “-v”, “-o-“, “trimcheck.d”, “-I.”]

    However I don’t know how to change the search path of rdmd.

    Reply
    1. Vladimir Panteleev Post author

      You need to clone the git repository with --recursive. Downloading a zipball will not include the submodules, so you would need to download those manually, unpack them in the correct location, and make sure you get the correct revision, too. But good to know you found a solution in the end.

      Reply
  9. Vortex

    Приветствую, Владимир!
    Помогите, пожалуйста, разобраться.
    Статус “Indeterminate” всегда, с Live CD, из-под Оси, все программы, которые могут писать, отключены.
    Скриншоты по порядку:
    1
    23

    Reply
    1. Vladimir Panteleev Post author

      Не могу сказать почему, но что-то поверх стертых данных TrimCheck все-таки записывается. Причем это текст (формат UCS-2), в скриншоте текст: 4e35" bu

      В теории может быть что прошивка диска переназначает стертые сектора на какие-то с другими данными, но никогда не слышал о таком поведении на практике, да и не логично (запись в таком секторе бы изменило другие данные). Более вероятен глюк прошивки, OCZ прославились своими глючными прошивками.

      Reply
      1. Vortex

        Спасибо за ответ. Такое же поведение и на другом OCZ Vector, 180. А вот на Agility 3, несмотря на его другие сюрпризы (невозможность восстановить со временем начальную скорость, как я читал, к примеру), наблюдается удаление за пару сек и пишется, что TRIM работает.

        Reply
  10. Vortex

    C новой прошивкой (3.0) всё то же самое. Статус “Indeterminate”, и это на всех Vector’ах, о которых я читал на форумах. Получается, они не отрабатывают TRIM?
    [spoiler=”1″][img]http://i77.fastpic.ru/big/2016/0625/11/30c7c849651941e715b187668442f411.jpeg[/img][/spoiler]
    [spoiler=”2″][img]http://i77.fastpic.ru/big/2016/0625/d1/e0401851fddd1a977045a62985d7c3d1.jpeg[/img][/spoiler]

    Reply
  11. muzungu

    Hello,
    For some reasons I’m using XP on a SSD with FAT32 – aligned 4K (I know I should upgrade with windows 7, xp not safe, etc.). I use 3 different tools to trim : Anvil utilities : it takes 5 minutes to trim. Or Solid state doctor demo, since include a free trim function – take 10 seconds. And finaly Boot it Bare metal for PURE dos, it also include a trim function, takes 10 seconds. I use the 3 programs because I don’t know if one of them REALLY works.
    I tried your tool. First, I launch trimcheck, then I do manual trim with one of the 3 tools mentionned, then I restart trimcheck. And I always get a result INDETERMINATE – Data is neither unchanged nor empty.
    What could I do to know if my manual trim is really working?
    Do you have a version of your trimcheck tool I could use in PURE dos?
    Thank you so much.
    Muzungu

    Reply
    1. Vladimir Panteleev Post author

      Do you use full-disk encryption? That can cause positive results to be seen as indeterminate.

      What does the data (the hex string trimcheck displays) look like, is there a regular pattern? Does it look anything like the original data?

      Reply
  12. muzungu

    Thank you for your answer.
    I don’t use full-disk encryption.
    I did new tests, and I realized that if do them quickly, I have the mention “Trim appears to be working!”
    So I run trimcheck, 2 seconds after the manual trim tool, and when finished, after 3 seconds I run again trimcheck. And then it says “Trim appears to be working!”.
    But if I wait a little bit more, let say I do the test 20 seconds after triming, the result is indeterminate. the first string of data and the second are always different. Why that?
    And if you don’t mind, please, may I ask you 2 questions :
    – some say that the trim command “communicate” with the OS to tell what blocks could be used. For me it’s nonsense. For example, I can trim my XP fat32 partition from pure dos, or even with linux. How could XP know what was done, since there is no communication between XP and the drive at that time?
    – Anvil utilities has a trim command that lasts 5 to 10mn, ssd’s led is working all the time until the end. How is it possible that one tool takes 10 seconds, and another one 10 minutes? I’m using an old inspiron 6400 laptop 2007, no raid or AHCI. It’s a sata1 port, but I think inside there is a bridge sata-to-ide.
    THANK YOU for your tool, and also your answers. The web talks a lot about trim, but most of the time it’s just copy-and-paste comments, it remains vague, unclear, especially for Os like XP and vista, who don’t support trim natively. And the information looks unreliable. I think you know more that many about trim. Thanks again.

    Reply
    1. Vladimir Panteleev Post author

      But if I wait a little bit more, let say I do the test 20 seconds after triming, the result is indeterminate. the first string of data and the second are always different. Why that?

      Hmm, this is usually due to another process reusing disk data, but it’s not common that this can be observed consistently. Try to close every program or service that’s not necessary to run the test. If it still happens, it might be some firmware or driver functionality.

      If you see the “TRIM is working!” result even sometimes, it almost surely means TRIM is working in general.

      And if you don’t mind, please, may I ask you 2 questions :
      – some say that the trim command “communicate” with the OS to tell what blocks could be used. For me it’s nonsense. For example, I can trim my XP fat32 partition from pure dos, or even with linux. How could XP know what was done, since there is no communication between XP and the drive at that time?

      Communication is entirely OS -> drive. This is why TrimCheck must rely on heuristics.

      – Anvil utilities has a trim command that lasts 5 to 10mn, ssd’s led is working all the time until the end. How is it possible that one tool takes 10 seconds, and another one 10 minutes?

      I don’t know for sure. It’s possible that the slower command uses smaller blocks, or it waits for each block to finish TRIM-ming before moving on to the next.

      The web talks a lot about trim, but most of the time it’s just copy-and-paste comments, it remains vague, unclear, especially for Os like XP and vista, who don’t support trim natively.

      Unfortunately it’s not possible to reliably know what the drives are actually doing. We can only observe the shadows on the wall, not the objects casting the shadows themselves. I agree there is a lot of misinformation (such as the “fsutil” “method” to verify if TRIM is working).

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *