Fault with disk de-fragmentation on Windows 7 using various tools

4

1

I've recently been trialling various defragmentation tools, specifically:

The problem is that I have noticed the same issue with all three of them; that the de-fragmentation process completes in most cases or sometimes seems to get stuck and leaves the program running. For all programs there is a hanging process left behind, whether it completes successfully or not.

It's also difficult to shut down the hanging process as I receive "Access Denied" errors when trying to kill the task using a variety of methods (taskkill from the command prompt, the sys internals process manager or using the Windows Power Shell). Sometimes I'm forced to reboot to kill the process.

From reading around the subject it appears that these tools all make use of Windows functionality to de-fragment the hard drive, is there perhaps a fault in either my Windows 7 or possibly my physical drive which is causing all three of these alternative tools to fail in the same way?

It is possible to run some of the tools by rebooting the machine and having them run without the full Windows operating system to prevent any problems with files being locked or otherwise interfered with, but this isn't ideal unless it's the only solution to this problem.

Further information / clarification a full disk check has been carried out on the drive which has reported no errors. The de-fragmentation processes are seen to be running several hours after the de-fragmentation process has 'completed'.

Typically I would leave the process running at around 4pm when I leave the office and find a process still running when I get into the office at 8am the next day, with the process having finished several hours before.

What next? I'm wondering whether this should be a community wiki rather than a question as an answer has been given as to what you should do to check for problems if this happens to you (scan the disk, etc.) and an explanation as to how the process works but I strongly suspect that this problem is unique to this one PC?

Richard Lucas

Posted 2010-02-17T08:59:23.240

Reputation: 2 744

Answers

2

You should check your hard drive with chkdsk

Win + R
Type: cmd (and hit enter)
Type: chkdsk /F /R /X c: (and hit enter, replace the c in "c:" by the letter of your suspected drive)

If it needs to be runned at reboot, it will ask... And if you want to check results after a reboot

Win + R
Type: eventvwr (and hit enter)

In the windows journal "Applications", look for the latest entry for Winlogon and open it. It will have the information about what it found in ChkDsk. (If you are looking for a scan results that was run at a time other than bootup, you should find it in the same place, but instead listed under ChkDsk)

You could also use a tool like HD Tune: S.M.A.R.T. info & scan disk

fluxtendu

Posted 2010-02-17T08:59:23.240

Reputation: 6 701

Hi, thanks for the response, I've already done a disk check in the way that you suggest and there were no errors reported. – Richard Lucas – 2010-02-17T09:28:14.757

2

These tools just use the windows defrag api which hasn't changed in Windows 7.

The reason they process might stick around for some time after they exit is that large disk operations simply take some time.

A defrag application analyzes the disk and then basically asks windows to "move this file from this place to that place on the disk". That operation can take some time, especially if it is a large file, or your disk is almost full, or just slow.

The applications most likely haven't "hung", they are just waiting for windows to finish the last operation they made. My guess is that you have some very large files ( > 2GB ) and the defrag operations just take some time to finish relocating them. They will eventually finish, and the process will close on it's own if you let them.

If you have a 40 GB file and the defragger asks windows to relocate it, it could easily take > 10 minutes to complete that task. You will need to wait that long, before considering the process hung. If you disk has slow write peformance (like an SSD or an older 4500 rpm laptop drive) these operations will take even longer.

If your disk is new and fast and can write at 100 MB/s you might do the math and think it should take only 200 seconds to move a 20 GB file, but when you factor in reading of the same disk with, the seek times, and the constant updating of the NTFS log-file, it will actually take considerably longer.

I use "My Defrag" all the time on Windows 7 without any trouble.

DanO

Posted 2010-02-17T08:59:23.240

Reputation: 2 494

Thanks DanO, that confirms my own understanding and I should perhaps have mentioned in my original question that the processes are seen hanging after having set a defragment operation running before I leave the office in the evening, normally meaning that the process has been "completed/hanging" for at least several hours. I've got one or two large database files and virtual machine hard drives, the largest of which is only 13GB in size. This is a fairly modern SATA drive in a Dell Optiplex 755 machine. Maybe I should try excluding the large files from the fragmentation operation? – Richard Lucas – 2010-02-18T09:15:36.580

2

May be worth considering other defrag tools such as degraggler(free) as well. Another issue is you may have anti virus or similar which is scanning all the files as they have not flagged as scanned previously (MSE flags) or your particular AV does a full scan every time. Disabling any protection (and going off line and network physically) will ensure minimal delay as will letting the defrag proceed with no other processes running for maximum speed of operation.

Also check your power setting does not put your drive to sleep before the de-fragmentation has had chance to complete as that will flag as uncompleted when you reawaken your PC. By default your PC will want to sleep unless you have configured it otherwise. More frequent defragmentation is indicated as it should take minutes not hours anyway; you kill drives prematurely by running them fragmented as well as inevitably losing speed. Several data partitions and or drives are worthwhile to facilitate separation and less inherent fragmentation happening in the first instance. Hope this helps.

Zedde

Posted 2010-02-17T08:59:23.240

Reputation: 21

Thanks for the answer Zedde, the computer is configured to never go to sleep as it's a works machine which needs to be running 24/7. Your other comments are interesting as well, I wonder whether there is a defrag tool which can be set to run when the machine starts up, similar to scheduling a full scandisk of the hard drive... – Richard Lucas – 2010-11-03T10:34:51.853