What does "Optimize Drives" do in Windows 8?

With Windows 8, there is an option to "optimize" a drive. This looks similar to the Defragment option of previous versions of Windows:

Screenshot

I have an SSD and I know that SSDs shouldn't be defragmented. However, Windows 8 recognizes that the drive is an SSD, and still says it needs optimization. What exactly does the "Optimize" option do in Windows 8? Is it safe for SSDs?


Solution 1:

What this does is run the Trim command on the drive (if it supports it). It does not actually defrag the drive, as is the case with a traditional rotating drive. It is probably a good idea to execute Trim to wipe blocks which are no longer in use.

The Windows Assessment Tool (winsat) is what initially determines whether or not the drive is an SSD and switches the behavior of Disk Optimizer. Under Windows 8, winsat runs under the Microsoft\Windows\Maintenance schedule in the Task Scheduler. This is the same tool (winsat) that would disable defragmentation of SSDs on Windows 7.

Just to re-iterate the point and drive it home: Do not think of Disk Optimizer under Windows 8 strictly as Defrag; it is now a general purpose tool that performs the appropriate disk optimization task based on the type of disk which is attached. The identification of disk type is based on winsat.

Official response to a similar question at answers.microsoft.com

Kiran Bangalore [MSFT] -

Hello, In Windows 7 - we turned off defrag for SSDs as you mention in your entry; but in Windows 8, we have changed the defrag tool to do a general optimization tool that handles different kinds of storage, and in the case of SSD's it will send 'trim' hints for the entire volume;

SSDs are storage devices made of flash memory; flash memory unlike hard disks are block erasable devices - they can be written to at a byte level but need to erased at a block level; Trim is a storage level hint that was introduced in the Windows 7 days to indicate that Windows is not using certain regions of the storage device; NTFS will send these trim hints when files are deleted or moved from those regions; SSDs consume these hints to perform a cleanup in the background called as 'reclaim' that helps them get ready for next writes. The SSD may choose to perform the optimization immediately, store the information for later optimization or throw away the hint completely and not use it for optimization since it does not have time to perform this optimization immediately.

In Windows 8, when the Storage Optimizer (the new defrag tool) detects that the volume is mounted on an SSD - it sends a complete set of trim hints for the entire volume again - this is done at idle time and helps to allow for SSDs that were unable to cleanup earlier - a chance to react to these hints and cleanup and optimizer for the best performance. We do not do a traditional defrag (moving files to optimizer there location for space and performance) on SSDs.

Thank you for your question and I hope this clarifies the need to run the Storage Optimizer on a regular basis.

Solution 2:

Optimize Drives in Windows 8, previously called Disk Defragmenter, helps to optimize the different types of drives that PCs use today. No matter which type of drive your PC uses, Windows automatically chooses the optimization that’s right for your drive.

Whilst traditional defragmentation of SSDs is not required, optimisation of SSDs is definitely required — SSDs do slow down due to file and free space fragmentation.

Condusiv Technologies have a short video called “Forum Post Response: SSDs and Defrag”, which should provide a clearer picture.

Solution 3:

Here is another answer for your reference, it's simply the re-branded version of what Windows defrag was used to be called. In Windows 8 it's now called Optimize Drives