Welcome to NavWin!
  

Introduction

I recently had a disk fragmentation problem on my old Windows XP machine. These notes might be helpful for other Windows operating systems so please read on, even if you are using something more modern! After doing this there was a noticeable boost in the Windows performance.

I had let my PC C: drive fill up with junk over the years and had not bothered to do a defrag. This meant that when I synchronised my iPad with my PC, the files had to be heavily fragmented in order to fit in the remaining space.

So when I went to defag the system, a strange thing happened at the end. I got this unexpected message:

What on earth does it mean “some files could not be defragmented”? But the actual picture was far worse than I expected. Was this really the best that defrag could do, 37% fragmentation even though I gave over 20% free space. It was fraggin’ useless. The picture shows what I was left with after the first defrag.

Looking at the defrag report, showed that the actual culprits where the recently added iTunes files

Fragments       File Size       Files that cannot be defragmented

1,761           45 MB           \Documents and Settings\Administrator\My Documents\My Music\iTunes\Mobile Applications\Dubble.ipa

2,243           45 MB           \Documents and Settings\Administrator\My Documents\My Music\iTunes\Mobile Applications\Death Worm.ipa

2,203           54 MB           \Documents and Settings\Administrator\My Documents\My Music\iTunes\Mobile Applications\DragonWarrior HD Lite.ipa

2,813           103 MB          \Documents and Settings\Administrator\My Documents\My Music\iTunes\Mobile Applications\ShrekKarting.ipa

….

14,975          768 MB          \Documents and Settings\Administrator\My Documents\My Music\iTunes\Mobile Applications\CTW Lite.ipa

5,448           1.17 GB         \Documents and Settings\Administrator\My Documents\My Music\iTunes\Mobile Applications\RAGE HD.ipa

The problem is that the iTunes backups are so huge individually and so fragmented (my fault for the latter) that the standard Windows defragger cannot seem to work out what to do. Even after I copied the suggested 17 files it still could not do a comprehensive defrag and more iTunes files appeared in the list. I then moved all the iTunes files to the D-Drive (17GB) and ran the Defrag again and the problem was solved.

 

No more fragmented files. However I then had 51% free space on my C: drive which suggests a fairly inefficient defrag algorithm is implemented in Windows XP. The fact that you can keep running the algorithm, again and again, and each time it seems to do a bit more work (using up the slithers at the start of the disk) suggest the algorithm is far from perfect. Here is the state after a few more tries. Notice the slithers start to disappear.

Anyway, once it gets to look like this, you can seem to run the defrag with only a small (but slightly noticeable) impact on your computer performance, so I wrote a .NET program to defrag the c: drive and d: drive, as a background process, 5 minutes after I log into Windows. It seems to work ok. You can find the source code in the code samples.

Moving the iTunes library permanently

So the final question is what to do with all the iTunes backup files? Do we move them back to C: or keep them on D: (the supposed data drive). Well first of all I wanted to see if there was any fragmentation on the D: drive (previously there was almost none). The report shows there was still not.

I wanted to keep my C drive clear and the D drive is for general data and software development. As it is my D: drive is now looking a bit small with all those extra GB of iTunes apps!

Anyway, to move the iTunes library, ensure your D: drive has the *.ipa files in a sub folder called Mobile Applications e.g.

·         D:\iTunesLibrary\Mobile Applications

Now following these steps

1)      Start iTunes while holding down the Shift key.

2)      From the new dialog, select ‘Choose Repository’

3)      Copy the *.itl file to the location D:\iTunesLibrary

4)      Double click on the file to select it

5)      In iTunes you will now see all your Apps appearing again, but in the new location