A few words of thanks would be greatly appreciated.

Defragmenting Your Hard Drive Under Windows 10/8/7

Defragmentation allows the consolidation of file fragments scattered on the disk to optimize the access time of the hard disk when reading large files.

What Is Fragmentation?

Fragmentation of your hard drive refers to the inefficient use of disk space caused by the scattering of information saved on the disk. This results in reduced performance, capacity, or both.

Defragmenting Your Hard Drive

Using My Computer

To start the defragmentation process, go to My Computer and right-click the disk of your choice. Go to Properties > Tools > Defragment Now.

Using Command Line

It is also possible to run the defragmentation in command line:

defrag c: -f 

You can defragment more quickly by forcing defragmentation at startup. To do this, run regedit, and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce.

Right-click New, then click Value string. Name it Defrag. Double-click on it, and enter: defrag.exe c: -f.

Restart Windows and log in. The defragmentation should now start before your computer starts up any other programs.

Selective Defragmentation of a File or Directory

You can defragment a single file or a directory using the CONTIG freeware from Microsoft.

For example, you can use contig myfile.iso to defragment a file, contig -s c:\windows\*.* to defragment a directory (and subdirectories), and start /low contig -s c:\*.* to defragment all files on the disk in the background.

Defragment While Screen Saver Is Active

The ultimate solution is to run the defragmentation whenever the screen saver is activated. JKDefrag is a simple freeware program that uses the built-in Windows defragmenter to defragment your disk automatically when your screen saver is deployed. Since it uses the Windows API, it is as safe as Windows' built-in defragmenter.

Download JkDefrag, and copy the JkDefragScreenSaver.scr file to C:\Windows .

Defragment the Pagefile (Swap)

By default, Windows Defragmenter cannot defragment the pagefile (swap, pagefile.sys).
Also, Windows is not able to defragment the files being used in real-time, such as those of the registry. This is problematic because ease of access to this file is critical.

PageDefrag is a freeware that can do this. Once you have downloaded it, start the program and select Defragment at next boot. Click OK to save your changes, then restart your computer.

Advice to Consider Before Defragmenting Your Hard Drive

During this process, sophisticated algorithms are used to determine the position of fragments and unused disk space. The NTFS file system allows you to use your PC during the defragmentation process, without disrupting it. However, you should note that files in use will not be defragmented.

You should also note that, when Windows is started normally, many processes are running in the background. To perform an optimal defragment, you should seriously consider starting Windows in Safe Mode before running the defragment.

Image: © Nikolai Titov - 123RF.com

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Defragmenting Your Hard Drive Under Windows 10/8/7 », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!