3.8. Defragmenting a Volume
You want to defragment a volume to improve disk access performance.
Using a graphical user interface
Open Windows Explorer.
Right-click the drive you want to defragment and select Properties.
Click the Tools tab.
Click the Defragment Now button. This launches the Disk Defragmenter application.
Click the Analyze button to find out how badly the volume is fragmented. After the analysis is complete, Windows will inform you whether it believes you should defragment the volume.
Click the View Report button to view statistics about fragmentation and to see the most fragmented files.
Click the Defragment button to proceed with defragmenting the volume.
Using a command-line interface
The defrag utility is the command-line version of the Disk Defragmenter application (available on Windows XP and Windows Server 2003). Run the following command to perform an analysis of the D: drive:
> defrag d: /a
/v option to see
similar information to the View Report button in Disk
> defrag d: /a /v
Finally, include the drive and
/v (for verbose output) to perform a
defragmentation of the volume:
> defrag d: /v
You can force a defragmentation even if disk space is low by
' This code simulates the 'defrag /a /v' command except it analyzes ' all fixed disks, not just a specific one. ' The Win32_Volume class is new in Windows Server 2003 ' ------ SCRIPT CONFIGURATION ------ strComputer = "." ' ------ END CONFIGURATION ...