Some files on this volume could not be defragmented
-
Over the past few months I have been attempting to defragment the hard drive within my computer, but the process stops without fully completing because “Some files on this volume could not be defragmented. Please check the defragmentation report for the list of these files”. Interestingly, when I view the defragmentation report the “Files which did not defragment” listing is empty. The same behaviour occurs when running the defragmenter in Safe Mode. Can you provide guidance on why the defragmenter is so stubborn and how this problem can be rectified? The computer is running Windows XP Service Pack 3.
Researching this question indicated that other users also experience the same issue, where the defragmentation process seemingly does not complete but returns the error about some files being unable to defragment yet the Defragmentation Report does not list any files. There are a few reasons that this error could be occurring. First, there could be errors on the drive preventing the defragmentation from correctly completing. Therefore, it could be worthwhile running the Check Disk utility to scan the drive for any errors and attempt to fix any such errors. Open My Computer and then right-click on the hard drive and select “Properties”. In the Properties window that appears, select the “Tools” tab. Within the “Error-checking” section there will be a button named “Check Now…”. This will launch the Check Disk utility which will attempt to scan the drive and correct any detected errors. In the window you should tick “Automatically fix file system errors” and “Scan for and attempt recovery of bad sectors”. Make sure that you have any other programs on the computer closed (as the Check Disk utility needs exclusive access to all files on the computer, which means that you can’t have anything else running) and then click the “Start” button. If Windows determines that things are open in the background (as there may be background Windows processes and services running which you are unable to see) then the Check Disk utility will notify that it cannot complete at this time and will ask whether you would like it to run again when Windows next starts. This will run Check Disk during the Windows boot process (before Windows itself has been loaded). This is useful because no other processes will be running in the background so the Check Disk utility will have full, exclusive access to the drive so that any errors can be fixed without interference. Should this message appear then agree and restart the computer so that the Check Disk utility will run. Once Check Disk has successfully run and any detected problems with the hard drive have been corrected, try the Disk Defragmenter once again to see whether it will successfully complete.
Should the problem still continue after running Check Disk then it is possible that open files are causing the Disk Defragmenter to fail. Much like Check Disk, the Disk Defragmenter also needs exclusive access to files and cannot properly execute while other programs and processes are running and changing the data on the hard drive. The basic premise behind defragmentation is that the data on the hard drive is reorganised so that the data comprising files is located contiguously on the drive, rather than portions of that file being scattered all over the hard drive. Having the data for the file located contiguously on the drive makes it more efficient to access the files since all the data for the file is located together. As you can see, if the data on the hard drive is being changed during the defragmentation process this makes it incredibly difficult to properly reorganise the data on the drive, thus the reason that defragmentation will often fail when data has been changed on the drive. This creates a problem, since some Windows system files are always being used when the operating system is running and thus can never be defragmented. Because these are system files they may not appear in the list of files which cannot be defragmented, potentially explaining why the list in the Defragmentation Report is empty.
Fortunately, there is a way around the problem where certain files cannot be defragmented because they are being used. A free utility on the Microsoft website is called PageDefrag (technet.microsoft.com/en-us/sysinternals/bb897426.aspx) which will allow you to defragment two of the most common files which cannot otherwise be defragmented: the Windows page file and the Windows registry files. The Windows page file is used to store the contents of virtual memory. When Windows needs more physical memory (e.g. when you open a new program) it will move something from physical memory into virtual memory (located in the page file on the hard drive) so that more physical memory can be freed-up. Then, later when (or if) the information stored in virtual memory is needed it will be swapped back into physical memory. Since the page file is always being used by Windows it is always open and cannot normally be defragmented. Likewise, the Windows registry files store the contents of the Windows Registry, which contains all of the system and program settings for the computer. These are also always open, since it is constantly being accessed, and thus cannot be defragmented.
The PageDefrag utility is able to defragment these files by starting the defragmentation utility during Windows startup, much like running the Check Disk utility during Windows startup. Download the PageDefrag utility from the Microsoft website and install the utility on your computer. Once you have scanned the computer using PageDefrag, it will present the results of the scan. If you find that the files are fragmented enough to warrant defragmentation then select “Defragment at next boot” and click OK. This will run the defragmentation utility when Windows next starts. This should hopefully defragment those troublesome files so that the normal Disk Defragmenter no longer reports that it is unable to complete.