26 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
        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

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current ye@r *