Monday 16 February 2015

Defragmenting Windows 7

I'm a big fan of Windows 7, more so than any other version of Windows since Windows 2000, and far more so than Linux and the like. I find the user interface easy to use for everyday computer work, yet flexible and easy to drill down in when there is a problem or I want to do something more complex. However, as Windows 7 gets older it is starting to develop a couple of bad habits.

One problem has been a tendency to corrupt its own user login, leading to the dreaded "User profile cannot be loaded" message when you try to sign into Windows. This is discussed by Microsoft here, although their solutions are somewhat incomplete, I think. I haven't seen this problem recently, so with a bit of luck Microsoft have corrected it in one of the enormous number of recent fixes they have put out.

The other problem is the old bugbear of disk fragmentation. This is where files are held on the disk drive as several different pieces, which Windows then reassembles as it reads them. This can slow things down a lot because it takes several disk accesses to get one file, because it undermines various read-ahead strategies used to speed things up, and because it uses up processor power doing the reassembly.

Important: for SSD drives, disk fragmentation doesn't affect performance as much, but defragmenting an SSD can significantly reduce its life expectancy. Don't do it.

'Defragging' used to be one of those things which 'everybody knew' was needed to speed up your PC, although by Windows XP disk fragmentation was unlikely to be the main cause of slow PC performance. Fragmentation came out of the cold with Vista, where the built-in defragmenter is supposed to run automatically, but often doesn't, and where the interface heavily discourages manual defragging. Windows 7 was supposed to have sorted this, though, by making automatic defragmentation more effective, and by making manual defragmentation at least a little more visible and easy to run. For several years I thought this was working well.

At Christmas I got a copy of the game Dragon Age Inquisition. It is an enormous game, which takes an age to set up, and is very slow to load. Even given the game's size though, I was getting level load times of around two and a half minutes, which is simply ridiculous.

Pretty much the first thing I checked was disk fragmentation: the Windows defragmenter had run a few days before and reported a fragmentation level of zero. So I checked various other things, to no effect, then went online to see if anyone else had this problem. A few people did, and it was clear that my load times for changing level/area were way over the top. One common factor in other people's problems seemed to be disk fragmentation.

The Windows 7 defragmenter doesn't show the pretty picture of where everything is on the disk, colour coded according to how fragmented files are in each disk area. Defraggler does, so I downloaded it and had a look.

According to Defraggler, the disk defragmentation level was something like 33%, most of the occupied drive showed up red, and when I looked at individual files there was a whole stack of Dragon Age files all with multiple fragments. It seems that the Windows 7 defragmenter has a different definition of fragmentation from Defraggler (and from me).

So I ran a Quick Defrag from Defraggler - it made no difference. Then I tried a Full Defrag - it took forever and made little difference. It looks as though the built in Windows defragmenter doesn't report fragmentation which can't easily be dealt with.

When I looked at the details of what was fragmented, it turned out to be mostly System Restore files. Windows 7 has massively increased the amount of stuff it puts into system restore: it uses it for file level 'old versions' as well, so that is probably why fragmentation is suddenly becoming important again.

On another PC I have looked at, with Norton 360 on, there was also a pile of hard-to-defrag Norton files, and Norton's own defragmenter also failed to either defrag or report on fragmentation it couldn't fix.

Defraggler lets me defrag individual files, so I manually defragged everything I could. Then I went to 'Disk Cleanup' and chose 'Clean up system files' when it came up. As well as (partially) emptying temporary files, this also gives the option (on the 'More Options' tab) of removing all but the lastest System Restore files. NB: this should not be done lightly. I made sure my backups were good before I did this.

For the computer with Norton 360 I then went to Safe mode and manually defragged the Norton files in Defraggler.

Then the full defragment worked a lot better, as there were fewer immovable files present.

Then I created a fresh set of System Restore files, in the less-fragmented space now available, and went around the cycle of cleaning up old System Restore files and defragmenting again. Finally I had fragmentation on that disk down to about 2%, which is good.

After all of this Dragon Age Inquisition loads levels/areas in just under a minute, typically. Since I am playing it a lot, and moving between areas is a big part of the game, I consider all of the effort spent defragging well worth it (especially since I was able to apply the knowledge gained to massively improve the responsiveness of a customer's PC shortly afterwards).

No comments:

Post a Comment