TRIM is a special ATA command which was developed to keep the performance of your SSD drives at peak performance for the duration of your SSD's life. TRIM tells the SSD controller to erase invalid and not used data blocks from the storage in advance, so when a write operation happens, it finishes faster because no time is spent in erase operations. Without TRIM automatically working at the system level, your SSD performance will degrade over time unless you manually use a tool which can send the TRIM command to it.
By default, TRIM is enabled for all SSDs. However, it is a good idea to check if TRIM is correctly enabled for your SSD in Windows 10 before proceeding. Refer to the following article:
In Windows 10, TRIM is supported for both NTFS and ReFS file systems. If it is disabled, you can enable it manually. After that, you might want to TRIM your SSD manually. In Windows 10, this can be with PowerShell.
To Trim an SSD in Windows 10, you need to use the Optimize-Volume cmdlet.
The Optimize-Volume cmdlet optimizes a volume, performing defragmentation, trim, slab consolidation, and storage tier processing. If no parameter is specified, then the default operation will be performed per the drive type as follows.
- HDD, Fixed VHD, Storage Space. -Analyze -Defrag.
- Tiered Storage Space. -TierOptimize.
- SSD with TRIM support. -Retrim.
- Storage Space (Thinly provisioned), SAN Virtual Disk (Thinly provisioned), Dynamic VHD, Differencing VHD. -Analyze -SlabConsolidate -Retrim.
- SSD without TRIM support, Removable FAT, Unknown. No operation.
In our case, we need to pass the -ReTrim argument to the cmdlet to start the Trim operation. The syntax is as follows.
Optimize-Volume -DriveLetter YourDriveLetter -ReTrim -Verbose
Replace the YourDriveLetter portion with your solid state drive partition letter.
Open an elevated PowerShell and type the command above. The letter of my SSD drive is F, so my command looks as follows.
Optimize-Volume -DriveLetter F -ReTrim -Verbose
When finished, close the PowerShell window.
The cmdlet will generate TRIM and Unmap hints for all currently unused sectors of the volume, notifying the underlying storage that the sectors are no longer needed and can be purged.
This can recover unused capacity on thinly provisioned drives.