Ask Leo! by Leo A. Notenboom

Why won't some files defrag?

Search First! Then browse: Categories | Full Archive | By Date | Newsletter

Home » Windows

Summary: When you defrag files the pieces of the file are physically arranged for quicker access. But you can't defrag some files. At least, not easily.

My wife's computer shows several fragmented files remaining after a defrag. She has tried uninstalling some programs but some will not uninstall. What can I do to help rid her of this problem or is there a program that will help with this?

My first reaction is to suggest not calling it a problem. It's not at all uncommon to have some files that refuse to defrag, and that's quite alright.

Let's look at some of the reasons, and some of the ways to force the issue if you still feel you need to.

Defragging, or more properly, defragmenting, is the process of taking all the parts or "fragments" of a file on your hard disk and making sure that they are physically next to each other, and in order. Files don't need to be that way ... the first part of your file could be on the outer rim of the hard disk, the next part somewhere on the inner portion, and other parts scattered in between. The "problem" that defragging solves is when all those pieces are next to each other and in order, the hard disk has to do a less work to access the file.

"The most common cause for files not getting defragged is that there's not enough free space on the hard disk to do so."

There are several technical approaches to defragging, but most require that you have enough free space on your hard disk for a copy of the largest file that needs defragging. Typically defraggers just require some percentage of free space, like 10% or 15%.

If there's not enough room for a second, temporary, copy of the file then the file cannot be defragged. The most common cause for files not getting defragged is that there's not enough free space on the hard disk to do so.

The second most common cause is that the file is in use by some program. That's why most defragging utilities suggest you close down all running programs prior to attempting to defrag. One of the things you can do when you run into this situation is to look at the list of files that were not defragged and see if they are in use. This article: How can I find out who is using a "file in use"? explains how. If you can, you can then shut down the program that has the file open, and try defragging again.

The next problem is that the operating system, as part of its normal workings, often has files open, and that therefore cannot be defragged. One very common example is windows paging or swap file. The folks out at Sysinternals.com have a free utility, PageDefrag for just this purpose. It can schedule a defrag of the system files on your next boot, before the system is actually running.

Similarly, booting from a CD such that the operating system is running from the CD and not your hard drive might also be an option to allow a normal disk defragger to run.

But my question is - why bother?

Defragging the files you can defrag easily, and regularly, gets you 95% of the performance gain you're looking for anyway. Jumping through these extra hoops to get the system files defragged is typically just not worth it, unless you've determined that these files are severely fragmented. And that's rare.

My recommendation is to simply do the normal defrag every so often. If you leave your computer on all the time, this article, What is 'defragging', and why should I do it? even includes instructions on setting up an automated defrag every night, which is exactly what I do.

Related:

Article C2704 - June 26, 2006

Helpful? Get new articles weekly by email in my FREE newsletter!

Your Name:
Your Email:


Why Subscribe?

Recent Comments
46 Comments

You have some good advice, Leo. My hats off to ya!

Posted by: Tom at September 6, 2008 5:19 AM

I installed MS XP SP3 upon virtual PC over Vista, the Virtual PC has Elastic virtual Hard drives, and all the files within the .vhd are less than 1.5gb, neverthenless, the .vhd weights about 3.5gb, I defragged it, i notieced most of the files were nicely aranged one next to other excepting some small pieces over there.
At sight I saw the space between most of the files and the small files over there was a bit more than the space used by most of the files, that makes me think, if I defragged those files, the page files, I may reduce the .vhd size about 1.5gb!, so, I need a Defragmeter thet defraggs it all.

Posted by: Eternalbodom at September 8, 2008 2:32 PM

I'm getting the same "some files would not defrag" message. However, my concern is that I have a huge amount of fragmented files and Windows XP keeps saying I still need to defragment. I have some very big audio recording files and I'm wondering if they're just too big to fix. Also, I'm using Norton System Works Speed Disk to optimize and it's taken days just to move 10% of the files. Should I move some of the files to my other drive and try to defragment a little at a time? I'm moving pretty slow in that drive and I need to be fast in the studio. Thanks for all your great advice, keep it up!

Posted by: Jim Rowbottom at September 21, 2008 8:05 PM

I have 57.23 gigs total on my NTFS,hard drive with only 13.24 gigs, (23%) free space. There's an enormous amount of fragmented files, (about as much as total contiguous files and unmovable files combined.) Up until a few weeks ago, when I defragged, I got a pretty clean slate and had plenty of free space, but the fragmented file(s)started growing and has continued to grow and my free disc space has dropped from 34% down to the current 23%. I've checked and none of my files are in use by another user,entity, etc. I've exhaused my defragging efforts and my question is - What happens when I run out of space? Is my computer going to lock up or what? Thanks, Jimmy

Fragmentation is not related to free space. In you case I would absolutely investigate where your hard disk space is going, but focusing on fragmentation is not going to get you there. I would have you start with this article: Where's my disk space going?
- Leo
25-Oct-2008

Posted by: Jimmy Moore at October 24, 2008 11:44 AM

i have windows xp .i clicked MY COMPUTER then SHARED DOCUMENTS and opened .nothing happend !!

Posted by: ali sherif at November 1, 2008 12:10 PM

How do you consolidate the system files so you have larger free contigous space on your drive?
It is impossible for my page file to be in a single fragment because I have unmovable system files scattered over the disk. I have jkdefrag, contig and pagedefrag. I also have format but I'd rather not use! It's not very important but I'd like to know how.

Posted by: Robert Newbold at November 28, 2008 8:21 AM

is there a way to reverse the defrag?? i did a defrag yesterday and now my computer wont play sound and some files are missing???

Nope. And besides, a defrag doesn't do anything that would result in those behaviours. I suspect you have other issues at play here. Might be time to run a CHKDSK on your hard drive, for example.
- Leo
18-Feb-2009

Posted by: colleen Wright at February 17, 2009 5:14 PM

theres a tip you can use to help force a file to defrag. it works with any reasonable small (less than about half your remaining space) file not locked by the operating system, even the most severely fragmented (3000+ fragments per 100 megabytes) files. If you have already run the windows defragger, it will at least have made some attempt to group free space together, even if it cant get all the files. So, you copy and paste the file into the same folder. This will force the OS to allocate space for another file, and it will choose the largest spaces available. It will then assemble the fragments of the original into the large spaces it allocated, which (barring the most severe of space shortages and file fragmentations) will usually drastically reduce the number of fragments in the copied file. When the copy is finished, delete the original and rename the copy to what the original was called. This will often jump start the defragger should you decide to run it multiple times, because it will no longer choke on the heavily fragmented ones at the top of the list (which you did this to =])

Posted by: Apocalypse-r at July 1, 2009 11:15 PM

Either paste and copy the file in the same place again. OR..look at the file's properties for something like "this file is from another computer and is locked" Its rare but happens once in a while with downloads from certain sites (or copies of the file)) Then unlock it and all is ok again.
After 6 years of using Diskeeper these are the only "tricks" I needed to know.

(XP pro servp.3)

Posted by: BarbaricFellow at November 10, 2009 4:01 AM

(Forgot to line it up correctly, please delete previous comment).

I have a 112 GB harddrive with a whole BUNCH of files that won't be defragged. See the list beneath.
Now, you say it's not a big issue, and that it's nothing to worry about. Good to hear!
But is that also so, when the files makes up about 60-75% of the hard disk capacity??? This one has bugged me like hell for quite some time..

The list:
Fragments File size Files that can't be defragged
3.631 289 MB \Programmer\Valve\Half-Life\valve\pak0.pak
3.605 321 MB \Programmer\Electronic Arts\Red Alert 3 Uprising\Data\EnglishMovieAudio.big
4.560 387 MB \Programmer\eMule\Temp\012.part
4.321 461 MB \Programmer\Electronic Arts\The Battle for Middle-Earth\W3D.big
4.094 467 MB \Programmer\Electronic Arts\The Battle for Middle-Earth II\Textures2.big
4.165 478 MB \Programmer\SpellForce\SpellForce 2 - Shadow Wars\base\pak\sf2_base06.pak
4.175 539 MB \Programmer\Electronic Arts\Command & Conquer 3\Core\1.0\WBData.big
5.160 564 MB \Programmer\Atari\Act of War - Direct Action\datamaps.dat
5.088 595 MB \Programmer\LucasArts\Star Wars - Empire at War\GameData\Data\Models.meg
4.426 596 MB \Programmer\Atari\Act of War - High Treason\Data_G1.dat
5.269 601 MB \Programmer\Electronic Arts\Command & Conquer 3 Kane's Wrath\Core\1.0\WBData.big
5.478 642 MB \Programmer\Atari\Act of War - High Treason\DataM2.dat
5.735 673 MB \Programmer\Atari\Act of War - Direct Action\datag2.dat
6.829 692 MB \Programmer\eMule\Incoming\Scat A Slut Slave Girl Eat Shit N Drink Piss (Caution It's Hard).mpeg
5.095 700 MB \Programmer\eMule\Temp\009.part
4.632 720 MB \Programmer\Electronic Arts\Red Alert 3 Uprising\Data\StaticStream.big
5.312 727 MB \Programmer\Electronic Arts\Red Alert 3\Data\EnglishMovieAudio.big
6.172 804 MB \Programmer\Atari\Act of War - High Treason\DataM1.dat
7.064 861 MB \Programmer\Atari\Act of War - High Treason\DataVInterface_Part01.dat
9.975 1.001 MB \Programmer\Electronic Arts\The Battle for Middle-Earth II\W3D.big
4.647 1.009 MB \Programmer\Electronic Arts\Command & Conquer 3\Movies\1.0\Movies.big
7.217 1,03 GB \Programmer\Atari\Act of War - High Treason\Data_G3.dat
7.694 1,11 GB \Programmer\Electronic Arts\Red Alert 3\Data\WBData.big
10.040 1,23 GB \Programmer\Atari\Act of War - High Treason\Data_G2.dat
18.606 1,32 GB \Programmer\Electronic Arts\Red Alert 3 Uprising\Data\WBData.big
9.903 1,45 GB \Programmer\Atari\Act of War - Direct Action\datag.dat

How much fragmentation really affects performance depends on several things. Large files with a few fragments - you'd likely never notice. Files that are accessed infrequently - ditto. The files you care about are the ones that you access a lot - any by a lot I mean a lot within the span of a few seconds. A lot of people spend a lot of time looking for perfect defragmentation only to find that once they get it it made little or no discernable difference. "Mostly defragmented" is typically good enough. That being said the best way to maximize defragability is to clear out as much space on the disk as you can before defragging. Some system files won't defrag, but more space means the larger files are more likely to. Empty temp files, empty browser cache, and give it another whirl.
Leo
16-Nov-2009
Posted by: Thomas A.W. at November 15, 2009 11:26 AM

Post a comment on "Why won't some files defrag?":






(Email Address will not be published.)

Remember Me?

By popular demand...
my tip jar
Cuppa Joe
Buy Leo a Latte!

(you may use HTML tags for style)

RSS feed Subscribe to the RSS Feed specifically for comments on this article.

Before commenting, please...

  • Read the article at the top of this page. If your comment shows you didn't, it'll be deleted and ignored.

  • Comment only on this article. Use the Google search box at the top of the page if you have a question about something else.

  • Don't include personal information in the comment. No email addresses. No phone numbers. No physical addresses.

  • Don't spam. Excessive links to unrelated sites within a comment or across multiple comments will cause all such comments to be removed.

  • Don't ask me to recover lost passwords or hacked accounts. I can't, and those comments will be deleted.

  • I can't respond to every comment. And I can't vouch for the accuracy of others who do.

Please wait. Your comment is being processed ...


Question? Ask Leo!