File fragmentation is, pretty much, a fact of life. You can run utilities like Windows Disk Defragmenter or Piriform‘s Defraggler (which lets you defrag just a single file instead of the whole disk), but they are slow – even if left running overnight, they often don’t finish on heavily fragmented drives (at least on my system). A very fast disk defragmenter is Auslogics Disk Defrag (but still slower than this technique on a heavily fragmented drive).
If you are thinking about defragmenting your hard drive, you might be interested in reading this article: Why You Don’t Need to Defragment Your Hard Drive
WARNING: there is always the risk of data loss when moving files around (even when using a defragmenting tool). Make sure you backup your hard drive first.
There is a faster way to defragment a heavily fragmented drive than using a defragmenting tool.
What you need
You need a spare hard disk with enough space to hold ALL your files – I use an external 1TB drive connected through my USB port.
What you do
1) Copy all your data files (including their directories) over to the spare drive – in general, you shouldn’t need to copy system or program files.
If you try to copy the entire drive, this will fail because Windows (or whatever OS you are running) locks certain files needed for normal operation. One way to get around this is to run an OS from a Live CD. I like to use Kaspersky Rescue Disk because it is a lean and robust Linux boot disk that automatically mounts all hard drives and can read and write NTFS disks. Since Windows isn’t running, I can copy over all the files on the disk (well, almost all the files, for some reason pagefile.sys and some restore folders generate an error when copying – the claim is that they are locked).
NOTE: The Kaspersky Rescue Disk does not seem to be the universal boot disk I thought. It has failed to boot on three HP / Compaq computers (one was a HP Pavilion a6000, the other a HP Compaq d530 CMT, and the third was a Compaq laptop).
So it might be advisable to look for an alternate bootable live CD or USB with writable NTFS support.
This site provides a list of live CDs. NOTE:This is an external site. While it was deemed safe at the time of writing, I am not responsible for its content. Since I have not used any of them, I offer no recommendations.
2) Once all the files are copied over, delete the files on the hard disk you want to defragment.
Your hard disk should now be mostly empty (except for system and program files).
3) If you like, you can boot your OS and run a disk defragmenting tool – it will run much faster since (1) there are fewer files to move around and (2) there is more free space on the disk to move the files to.
4) Copy the files back to your hard disk. As the files are copied back, they will be written back whole, rather than fragmented.
Sometimes, large files will still be fragmented – though not to the degree they once were (I have some large video files – bigger than 10GB – that never fully defragment; I suspect this is a limitation of the NTFS file system).
It still takes a long time to defragment, but not as long as using a defragmenting tool.
NOTE: This works best for a heavily fragmented drive. There is no point in moving ALL your data files if only a few of them are fragmented. If you have a few fragmented files, then use a tool like Piriform’s Defraggler or Auslogics’ Disk Defrag to only defragment those files.NOTE: while Auslogics’ Disk Defrag offers the option to defrag single files, when I tried, nothing happened. I was using version 18.104.22.168 on Windows XP with Service Pack 3.
NOTE: I have no connection with the products or companies mentioned.