Managing File System Fragmentation
All disks, regardless of the file system in use (FAT16, FAT32, or NTFS), divide disk space into clusters, which are groups of disk sectors that are the smallest units of space available for holding files. The size of clusters depends on the file system in use and the size of the partition; for example, for NTFS-formatted volumes of more than 2 GB in size, the default cluster size is 4 KB.
A file is stored in the first available clusters on a volume or partition, and not necessarily in contiguous space. Thus if empty space has been left on the volume as a result of moving, editing, or deleting files, these small noncontiguous clusters will be used. Access to files fragmented in this way takes a longer time because extra read operations are required to locate and access all the pieces of the file. You can defragment your disks with either the Disk Defragmenter GUI tool or the command-line defrag.exe tool.
Disk Defragmenter
Windows 7 provides a tool called the Disk Defragmenter to locate and consolidate these fragmented files into contiguous blocks of space. Consequently, access time is improved. You can access the Disk Defragmenter by clicking Defragment now from the Tools tab of any partition's Properties dialog box or by clicking Start > All Programs > Accessories > System Tools > Disk Defragmenter. You can also access this tool by typing defrag into the Start Menu Search field and clicking Disk Defragmenter in the Programs list.
Any of these methods opens the newly redesigned Disk Defragmenter tool. This tool enables you to configure scheduled defragmentation or to analyze and defragment any disk volume immediately.
You can perform the following actions from the Disk Defragmenter:
- Schedule Defragmentation: Click Configure schedule to set up a schedule. By default, Windows 7 schedules defragmentation to take place on all disks every Wednesday at 1:00 AM. You can modify this schedule if desired by selecting options from the drop-down lists shown, or select disks to be defragmented by clicking the Select disks command button.
- Analyze disk: Select a disk and click Analyze disk to have the Disk Defragmenter check the current level of fragmentation. Although the dialog box says you need to first analyze your disks, they are first analyzed when you click Defragment disk.
- Perform an on-demand defragmentation: Select a disk and click Defragment disk. Disk Defragmenter first analyzes the disk and then performs a multipass defragmentation, displaying its progress. If you need to stop a defragmentation in progress, click Stop operation.
NOTE It is recommended that you have at least 15% of free space on a disk volume before running the Disk Defragmenter. Otherwise, the defragmentation process will take much longer and might be incomplete. Use the Disk Cleanup tool first, if necessary, to optimize the amount of available free space.
TIP: Disks can become quite fragmented after you've uninstalled applications or deleted large files. Further, when installing large applications, the installation runs much better when plenty of contiguous space is available and the application will also run better later. It is a good idea to analyze your disk after deleting large files or before installing applications and then run the defragmentation if necessary.
In this tutorial:
- Windows Disk Management
- Managing Disks and Volumes
- Basic and Dynamic Disks
- Working with Basic Disks
- Converting Basic Disks to Dynamic
- Working with Dynamic Disks
- Troubleshooting Disk Problems
- Managing File System Fragmentation
- The Defrag.exe Command-Line Tool
- RAID Volumes
- Creating a RAID-0 Volume
- Creating a Spanned Volume
- Creating a RAID-5 Volume
- Using DiskPart to Create Striped, Mirrored, and RAID-5 Volumes
- Managing and Troubleshooting RAID Volumes
- Configuring Removable Drive Policies