In Windows 8, the humble defragmentation tool has evolved to carry on other roles, apart from its disk defragmentation role. While in Windows 7 and Windows Vista, the disk defragmentation tool did improve, it still continued to only defragment the fragmented files and data. In Windows 8 however, additionally, it optimizes your storage in Thinly Provisioned environments – using Storage Optimizer. The Defragment tool in now called Defragment and Optimize Tool in Windows 8, and includes the Storage Optimizer.
Defragment and Optimize Tool in Windows 8
What is Storage Optimizer in Windows 8
The Storage Optimizer in Windows 8, now takes care of maintenance activities like compacting data and compaction of file system allocation for enabling capacity reclamation on thinly provisioned disks. If your storage platform supports it, Storage Optimizer will consolidate lightly used ‘slabs’ of storage and release those freed storage ‘slabs’ back to your storage pool for use by other Spaces or LUNs. It does so periodically, without any user intervention from the user and completes the task provided the task is not interrupted by the user.
In Windows 8, when the Storage Optimizer 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.
What is TRIM
TRIM is a storage level hint, NTFS sends for some normal inline operations such as “deletefile.” NTFS will send such 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 short, TRIM, introduced in Windows 7, is a way of communicating with SSDs about sectors that are not needed any more. You can learn more about it at TechNet.
Solid State Drives and Windows 8
Solid State Drives or SSDs are flash memory based block-erased devices. This means that when data is written to the SSD, it cannot be over-written in place and must be written elsewhere until the block can be garbage collected – ie they can be written to at a byte level but need to erased at a block level. Since the SSD has no internal mechanism for determining that certain blocks are removed and others are needed. The only time the SSD can mark a sector ‘dirty’ is when it is over-written. In other cases, such as when a file is deleted, the SSD retains these sectors because the deletion is performed as a MFT change only, and not as an operation to all the sectors of the file.
In Windows 7, Microsoft had turned off defragmentation for Solid State Disks. In Windows 8 however, since the tool has undergone a change into a general disk optimization tool, you will see it enabled by default for SSDs too.
In this scenario, where an SSD is present, the tool sends ‘TRIM’ hints for the entire volume. A traditional defrag is not performed on SSDs, says Microsoft.