Use Defraggler for defragmenting disks in Windows
File fragmentation is a big issue that usually does not get much attention. It occurs when a hard drive partition contains tens of thousands of files (like it always does) and a file gets updated but there is no room right after it to keep the file written sequentially. So the updated part gets written elsewhere on the hard disk, sometimes in one part, sometimes to several different places on the hard disk. This means that the next time Windows wants to read from or write to the file, the hard disk controller must access several places all over the disk to read or write information - meaning that a file access time gets higher and you must wait longer for an operation to complete. For one file this might mean only a few milliseconds, but if your hard drive is nearly full and fragmentation level is high, this turns easily into tens and tens of seconds of waiting.
If Windows XP or Vista is installed on a Solid State Drive (SSD), you should disable any automated defragmentation! Defragmenting SSD-s is unnecessary and it might decrease the lifetime of the drives, or even cause complete drive failures.
Windows 7 and later are able to run special TRIM commands automatically on SSD-s - this is a replacement for defragmenting.
Hybrid drives, such as Seagate Momentus XT still need defragmentation because the SSD space is used for application cache only.
While Windows has a Disk Defragmenter built in, its efficiency is not that good. Windows XP users do not even have easy access to the scheduling capability. But the biggest problem is that Windows Disk Defragmenter does not defragment large files and this lowers performance of the whole computer.
Piriform Defraggler is able to defragment all files, run on a schedule and perform boot-time defragmentation (just like Sysinternals PageDefrag can in Windows XP). You can also defragment specific folders or files for quick optimization.
For SSD-s, Defraggler runs TRIM commands, if necessary.
Please make sure that you have sufficient free disk space (at least 15% of total disk space) - no disk defragmenter can do its work well if there is not enough free room available. Read the Free up disk space in Windows and Remove temporary files with CCleaner articles for detailed instructions.
Because Windows Vista and later have scheduled defragmentation enabled by default, it is a good idea to turn it off to avoid overlapping schedules and unnecessary performance loss during the scheduled tasks.
Those who have installed Windows 8 or 8.1 on SSD, must take this step: there is a known bug in Disk Defragmenter that causes it to start defragmentation process (not TRIM). Ultimately, this leads to decreased lifetime and failure of the SSD.
Automating defragmentation/TRIM process with Defraggler is described later in this article.
In Windows Vista and 7, open Start menu and type defragment into Search box. Click Disk Defragmenter.
In Windows 8 and 8.1, open Settings Search using keyboard shortcut Windows Key+W, type defrag into Search box and click Defragment and optimize your drives.
Windows Vista users will once again meet the most beloved User Account Control Prompt. Click Continue.
In Windows Vista, clear the Run on a schedule (recommended) check box. Click OK to close Disk Defragmenter.
In Windows 7, click the Configure schedule button in Schedule section.
In Windows 8 and 8.1, click Change settings in Scheduled optimization section.
In Windows 7, the Disk Defragmenter: Modify Schedule window opens.
In Windows 8 and 8.1, the window is entitled Optimize Drives.
Clear the Run on a schedule (recommended) check box. Click OK and Close to exit Disk Defragmenter / Optimize Drives window.
Open Defraggler download page, locate Defraggler Free section and click Piriform.com.
After downloading and launching, Defraggler Setup Wizard opens Welcome dialog. Click Next to move on and accept English as the installed language.
In the Install Options screen, clear the Add Desktop Shortcut check box - you do not need to open Defraggler that often. Then click Next or Install.
Then some promotional offer might appear if you do not have Google products installed. Do not install any software offered here as you probably do not need additional toolbars or web browsers. Too many toolbars will make any browser slow, so please remember not to install everything blindly.
In the example below, clear the Install the free Google Toolbar along with Defraggler box and click Install.
After the setup is complete, clear the View Release notes box and click Finish. Defraggler will open after this automatically.
Sometimes, restart is required to finish updating Defraggler. Save and close all open documents and programs/apps and click Finish, leaving Reboot now selected.
After Defraggler opens, right-click any listed drive/volume/partition and select Analyze Drive from the menu. Alternatively, you can click a drive and use the Analyze button on the bottom of the window.
Please close all running programs to allow Defraggler to do its work well - locked (in use) files cannot be defragmented.
The analysis might take a few minutes to complete. See the Fragmentation column on top right or in the Status section for results.
If the percentage exceeds 10, you should optimize the drive by clicking the Defrag button to run a full defragmentation. The process might take several hours to complete on large hard drives.
You can also run a non-comprehensive optimization by clicking the arrowhead pointing down on the right side of the Defrag button and selecting the Quick Defrag option. This one is much faster, but not as thorough as the full defragmentation.
If S.M.A.R.T. (Self-Monitoring Analysis and Reporting Technology) is available on your PC, there is also the Disk Health line available. Make sure it reads "Good", otherwise your hard drive might be failing soon.
If needed, use the Shutdown after Defrag or Close program after Defrag options in Settings menu to automatically turn off the PC or close Defraggler after defragmentation is complete.
The Drive map tab explains the colored map right under the drive list. Health tab lists detailed information on the selected hard drive.
If Recycle Bin contains many files or is corrupted, Defraggler offers to empty it before starting the defragmentation - this might make the whole process much faster.
In case you are absolutely sure the Recycle Bin contains nothing important, click Yes in the dialog. If the special folder is corrupted, you should certainly click Yes to fix it.
After Defraggler finishes defragging the drive, its Status section states "Defrag Finished" or "Quick Defrag Finished". You should analyze and defragment all drives in your computer to retain optimum performance.
If fragmentation level stays high even after full defragmentation, you should run Defraggler in Windows Safe Mode. This ensures best results with files that are normally in use by background programs and Windows services.
If you do not want to optimize disk contents, you can defrag only the items that are fragmented. This is much quicker than full defragmentation, but might be a tad slower than quick defrag. The method always ensures that all files (except those in use) are aligned sequentially on the disk.
First, analyze a drive. Then open Files list tab and put a check mark in the Filename check box on the left. This select all items that are fragmented.
Click Defrag Checked to start the process.
Please close all running programs for best results. The defragmentation process might take up to an hour if the number of fragmented items is high.
If really-really necessary, click Pause or Stop.
After Defraggler finishes, click OK.
In most cases, some files cannot be defragmented - this is completely normal. To overcome troubles with locked files, run Defraggler in Windows Safe Mode.
Defraggler allows creating a fully automated defragmentation (or TRIM for SSD-s) schedule in Windows. This removes the need to run the lengthy process manually.
Because you disabled automatic defragmentation in the beginning of this tutorial, make sure you set up monthly schedule for all drives/partitions.
First, open Settings menu, expand Priority sub-menu and click Background. This ensures that the scheduled defragging will not consume too much processing power and that you can continue working normally during the automated defragmentation. As a side effect, the defrag will take longer to complete.
Next, open Settings menu again and click Schedule.
In the Schedule window, select a Drive. Then enable the Schedule defragmentation for chosen volume option. "Volume" and "drive" are used interchangeably in this article.
Select Monthly in the Period section and use the options on the right to set a starting date and time for the scheduled defrag. You should set a time when the PC is most probably turned on.
Set the task to run on specific Day(s) or Day(s) of week.
Choose Full or Quick from Defrag type combo box in Advanced section. In most cases, use full defragmentation; the quick option is useful only if you rarely create or modify files on this PC.
Click OK to create the schedule.
If you have more than one drive or partition, you should set automatic defragmentation on these, too. But please do not overlap the schedules to avoid system slowdowns!
To check that Defraggler actually runs at specified time(s), see Windows Task Scheduler logs.
In Windows XP, open Start menu, expand Accessories, System Tools and click Task Scheduler.
In Windows Vista and later, open Start menu or Start screen, type task and click Task Scheduler or Schedule tasks.
Windows XP users should then open Advanced menu and click View log. This opens Notepad with logfile for all scheduled tasks. Use Find command (keyboard shortcut Ctrl+F) to search for Defraggler tasks.
In Windows Vista and newer, click Task Scheduler Library on the left. Then locate and click the task with the name starting with "Defraggler". Open its History tab and check results.
"Return code 0" in Event ID 201 (Action completed) means that defragmentation finished successfully.
If the tab is empty, the task has not run yet. Or you need to click Enable All Tasks History (available since Windows 7) in the Actions pane on the very right.
Task logs in Windows Vista, 7, 8 and 8.1 are also available in Event Viewer. Expand Applications and Services Logs, Microsoft, Windows, TaskScheduler and click Operational.
Because several system files are locked while Windows is running, it is necessary to defragment these before Windows starts. Common examples are Event Logs, Registry, User Accounts database and Paging File (aka Pagefile). The latter can cause serious slowdowns if it is badly fragmented and Random Access Memory (RAM) is full.
While defragmenting Paging File at boot time was removed from free versions of Defraggler some time ago, it is now back since version 2.18.
Do not enable Boot Time Defrag on SSD-s! Use scheduled TRIM instead.
While Windows XP users can also use the small Sysinternals PageDefrag utility for boot-time defragmentation, the program will not run properly in Windows Vista, 7, 8 and 8.1. That's where Defraggler can help.
To avoid unnecessary waiting while paging file is defragmented at every boot, set virtual memory to fixed size.
Below is an example of badly fragmented Paging File on a Windows XP system. Because the file parts are all over the disk, it takes considerably more time to write to or read from the file - and this causes poor performance.
To enable defragmenting the system files, open Settings menu, expand Boot Time Defrag and click Run Every Time. This means that Event Logs and Paging File will be defragged each time Windows starts, excluding returning from Sleep or Hibernation modes.
Please note that defragmenting Paging File might take up to 30 minutes the first time. If you often experience long delays during boot time defrag, you should set the file to a fixed size.
Defraggler offers rebooting right away. Click No to keep working, or Yes to restart your computer and defrag the files.
After you restart your computer the next time, a special blue (in Windows XP only) or black screen will appear after displaying Windows logo. The system files will then be defragmented for optimum performance.
Please wait until the process is complete - defragging Paging File (pagefile.sys) for the first time might take up to 30 minutes in case it is badly fragmented. Never turn off or reboot the PC during this process!
Windows will start as usual after the boot-time defragmentation is complete.
In case you do not want to defragment a whole drive, you can check the fragmentation level and run defrag on specific folders or files.
First, ensure that Defraggler is not running. In Windows Explorer, right-click the folder or file you want to analyze. Open Defraggler menu and click Check Fragmentation.
In Windows Vista and later, User Account Control will pop up. Click Continue or Yes.
After the check is complete, Defraggler will display the results. If no fragmentation was detected, click Close.
Even if fragmented files were detected, click Close again. Next, right-click the item in Windows Explorer and select Defragment from the Defraggler menu.