{WED} Watch SSD TRIM Work Using Optimize-Volume PowerShell Cmdlet

I can’t help it. I *LOVE* this kind of stuff. I just learned that with the right syntax, you can watch SSD TRIM work using Optimize-Volume PowerShell cmdlet. The TRIM operation on an SSD erases data blocks that are no longer in use. Then, it returns them to the pool of available blocks for re-use.

According to SearchStorage.TechTarget “The use of TRIM can improve the performance of wriitng data to SSDs and contribute to longer SSD life.” I just counted. Of the 10 drives I have installed on my production PC, 4 of them contain SSDs. That said, one of them uses a dual RAID controller for 2xSamsung EVO 250 SSDs. I just learned it doesn’t support the TRIM operation (which is good to know, all by itself). All three of the others TRIM works just fine. (These are: my boot drive, my work data drive F: OCZ3-120 and my scratch drive G: ScratchSSD.) When I tried to TRIM the L: DualSam2 drive, here’s what the cmdlet told me:

Watch SSD TRIM Work Using Optimize-Volume PowerShell Cmdlet.notrim

Because the L: drive uses a Syba Dual mSATA to SATA RAID controller, it doesn’t support the TRIM operation. Sigh.
[Click image for full-sized view.]

How-to: Watch SSD TRIM Work Using Optimize-Volume PowerShell Cmdlet

The syntax for the cmdlet is pretty straightforward, but the good stuff appears in the output it produces in verbose mode. I’ll show an illustration first, then spell that syntax out in detail.

Watch SSD TRIM Work Using Optimize-Volume PowerShell Cmdlet.ReTrim

Unless you enable verbose mode, Optimize-Volume runs silently. The space trimmed value is usually within 1-2 GB of the free space value.
[Click image for full-sized view.]

The command syntax is
Optimize-Volume -DriveLetter X -ReTrim -Verbose

Substitute the actual drive letter you wish to optimize for the italic X in the syntax example, as I did for drive F in the preceding screencapture (e.g.Optimize-Volume -DriveLetter F -ReTrim -Verbose). It will also do a nice little progress bar animation while the operation is underway, too.

How-to: Use the -Analyze option to See if a Drive Needs Optimization

One more thing. If you replace the -ReTrim option with the -Analyze option for the Optimize-Volume cmdlet, you’ll get another set of verbose output that shows analysis activity and then reports on what it finds. Here’s what this command said for my unTRIMmable L: DualSam2 drive, just for grins:

Watch SSD TRIM Work Using Optimize-Volume PowerShell Cmdlet.Analyze

Unless you enable verbose mode, Optimize-Volume runs silently. The space trimmed value is usually within 1-2 GB of the free space value.
[Click image for full-sized view.]

The regularly scheduled drive optimization task occurs on Windows 10 machines weekly, so I didn’t expect to see anything out of the ordinary. That said, this is one of those cases where it’s more fun to watch the tool work than it is to know it’s working silently in the background. Enjoy!

Here’s a link to the MS DOCs documentation for the Optimize-Volume cmdlet. It has more info, examples, and covers other cmdlet capabilities I didn’t mention here.

facebookgoogle_pluslinkedin
facebookgoogle_pluslinkedin

Leave a Reply

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