Why won’t some files defrag?

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?

Actually, this is not necessarily a problem. It’s not at all uncommon to have some files that refuse to defrag, and that’s quite alright. Chances are it won’t impact performance in any noticeable way, and that’s really what defragging is all about: improving performance.

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

Defragmenting

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 everywhere in between.

The “problem” that defragging solves is simply that when all those pieces are next to each other and in order, the hard disk has to do a lot less work to access the file.

Defragmenting obstacles

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. No, that’s not technically necessary, but it makes the defragmenting tool significantly simpler, faster and otherwise more reliable.

Hard Disk InteriorAs a result, many, if not most defragmenting tools just require some fairly random percentage of free space, like 10% or 15%. If there’s not enough room for a second, temporary, copy of a file that needs to be defragmented, then that file cannot be processed.

The most common reason files do not get successfully defragged is simply 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 close the program that has the file open, and try defragging again.

The next problem is that the operating system itself, as part of its normal workings, often has files open in such a way that those files 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.

Why bother?

My question to you is a simple one: why bother?

Defragging the files you can defrag easily, and doing so regularly, gets you 99% 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”.

In fact Windows 7 and better will do it automatically for you, once a week.

That’s plenty.

This is a minor update to an article originally posted : June 26, 2006

There are 55 comments:

  1. Carl Goodwin Reply

    I just reformatted my hard drive, and my machine says the same thing when I defrag after all my programs are re-installed. Funnily enough though, there are no programs in the list of “un-defragged programs”, even though it says to look in the list!

  2. Dave Reply

    Sometimes the easiest solutions are the best. Try defragging in “safe mode” and turning off your screensaver. Altho, as Dave says, you have to have enough free space on your harddrive for the defragger to work right.

  3. frank pearce Reply

    just did a defrag and this file wouldn’t defrag…..system volume informationrestore{12920…… what does it mean wasn’t like it a few days ago help thanks

  4. Leo Notenboom Reply

    Your question is answered in the article you just commented on.

  5. joe holes Reply

    i have a bunch of blue files scattered in large chunks and they wont seem to move closer together in one big chunk any ideas?

  6. art Reply

    Do nothing. Blue chunks is what you want. That there are spaces between chunks means nothing.

  7. charlie Reply

    Thanks for the info Just one question. I have a red line as well can broadband be the cause.Will a virus do it. (sorry thats two)

  8. ryan raven Reply

    i know this has nothing to do with what we are talking about but im buying new motherboard woth a LGA775 socket will my 478 fan fit? and if u want good performace with diskeeper buy perfect disk as well and do loads of reboot times with it.

  9. carl Reply

    all my system files are evreywhere any way to move all system files into 1 chunk?

  10. THOMAS BUCKLEY Reply

    i have 37% free space on harddrive, but a lot of red fragmented files that won’t defrag,is there any way i can get rid of most of these

  11. Carrie Reply

    I have tried everything to defrag my XP laptop E drive which is the recovery drive..it is down to 6% which is too low. I deleted a ton of games and empieted the trash bin. Nothing happened. Can you help and is my computer going to crash?

  12. greg Reply

    My laptop will not defragment at all. I am running XP. I start the defrag and nothing happens. Can you help?

  13. Joseph Reply

    What would cause files not to defragment is not the lack of free space because i have 79% of free
    space and my computer is slowing down more and more everyday what should i do!!!

  14. mercgal Reply

    The following file won’t defrag f28ebf0cde5a4d16a78b376afd10a98c.sdf
    Can anyone tell me if this is safe to remove? It is found in the Docs & SettingsAll UsersApplication DataMicrosofteHomeEPG
    Thanks for any help.

  15. Lil Brat Reply

    I cannot defrag my C: drive because the files that need to be defragmented are no longer in my computer (so i think)… A lost file (recovery was done) to obtain deleted files after a master reboot was done. (not by me ) lol… anyhow I cannot delete these files so I cannot defragment them either. My Hard drive says I have space available but when i go to defrag. there is blocks of red fragmented files that wont defrag so it is lagging my computer… Any help on how to remove these files will be appreciated…I have 31 % of free space but I shoud have 100 GB free…The files that are stuck are jpg’s and mov files… can anyone help me ? I have windows XP Home Edition

  16. Drakonis Reply

    Did NOT answer the question.
    The built in WinXP defrag won’t run period without 15% free space. But even then, some files won’t defrag. That is the question to which no answer was given. 10 gigs on a 60 gig hard drive is more than enough for a defrag..yet some files will not defrag. for example.

    This article was a waste of my time….

  17. Leo A. Notenboom Reply

    —–BEGIN PGP SIGNED MESSAGE—–
    Hash: SHA1

    Apparently you didn’t read the entire article. There are more reasons listed
    there than just disk space.

    Leo

    —–BEGIN PGP SIGNATURE—–
    Version: GnuPG v1.4.7 (MingW32)

    iD8DBQFHDqJBCMEe9B/8oqERAsHsAJwPlPMmh7tFzyJ92BhRgiKKv3OZlgCeJWPD
    E+yAYX9WquRMpX+KNIQCtd0=
    =pnLA
    —–END PGP SIGNATURE—–

  18. Bobcat Reply

    Leo’s explanation is correct : the available free space has to be atleast twice the size of the largest file to be defragmented. So the actual percentage of free space is not the only factor, but the size of the fragmented file is important too.

    There are also some system files like the Master File Table (MFT) that cannot be defragmented by the windows defragmenter, but requires a third party utility. While defragging some of the other system files may not be important, the MFT and paging files need to be defragmented for the best performance. Essentially, defragment the ‘normal’ fragmented files and the MFT, and you’re all set.

    I use an automatic defragmenter that defragments my 3 drives as and when necessary quietly in the background, so remembering to defrag or scheduling one for late nights is not a factor. I like it much more than the old conventional manual defrag or scheduled defrag because it automatically and intelligently tackles fragmentation in the background, without interrupting my computing. And I dont waste *my* time defragging 2x160GB and 1x 250GB worth of drives..

  19. Mack leyland Reply

    My C drive , which contains the operating system and all programme files will not defrag, I can acces the defrag menu but once I select defrag it hangs at 15% there is 19GB free space on that drive.

  20. Joe Reply

    Yes, I read the article, but still unsure where my problem, “based on its size” fits in.
    I have an IMAGE file that won’t defrag that consists of 16,583 Fragments and its size is 46,023 MB. I have a 111 GB drive with 48% free space. Can this be a major contributor to why my machines are running slow? If so, what can I do to fix it?

    Thank you,

    Joe

  21. Leo A. Notenboom Reply

    —–BEGIN PGP SIGNED MESSAGE—–
    Hash: SHA1

    Wow… that’s a big file. 45gig on your 111gig hard drive..
    that one file is taking up nearly half your space. Yes, I’m
    not at all surprised that the file wouldn’t defrag.

    There’s no way for me to know whether its fragmentation is
    responsible for your system slow down – that depends too
    much on how you use your system and what else is running
    on it.

    And what it is one does with a 45 gigabyte file.

    Leo

    —–BEGIN PGP SIGNATURE—–
    Version: GnuPG v1.4.7 (MingW32)

    iD8DBQFHlp9SCMEe9B/8oqERAhlKAJ9Xqypx9mgfxPPklCbIlwogDe0HTwCeP9GI
    CPLU3gPOxEUgPGBWjeBulZc=
    =KGgi
    —–END PGP SIGNATURE—–

  22. liascos Reply

    my xp craptop wont even start to defrag at all.
    60 gig drive with 17 gigs free.
    but the analize and defrag buttons are dead.

  23. Chris Reply

    I’m surprised that you recommend defragmenting your hard drive every night. Do you WANT your hard drive to die from all that extra work? Once a month, or even 3 months is PLENTY.

  24. Leo A. Notenboom Reply

    —–BEGIN PGP SIGNED MESSAGE—–
    Hash: SHA1

    First, I don’t believe that defragging really shorten’s the
    drive’s life appreciably.

    That being said, I did drop back to once a week, just
    because nightly defragging was of little benefit.

    Leo

    —–BEGIN PGP SIGNATURE—–
    Version: GnuPG v1.4.7 (MingW32)

    iD8DBQFH9UmxCMEe9B/8oqERAgaAAJ9FJmf+WanexQ/EbAVomixCMZVf9gCeNV8D
    Fdl8Zh6+4N2+E4lWWaBNQx4=
    =ROIe
    —–END PGP SIGNATURE—–

  25. Ruud van Gaal Reply

    The hint for PageDefrag is reason enough alone for this article.
    Almost 10 years ago, I had a bunch of SGI O2′s where a defragger would be active around 3am-5am. It would start, defrag, then remember where it was for the next day. Things like this should be part of the OS; it really helps your system’s speed and Microsoft would be better off with some good news about their currently flaking OS. ;-)

  26. Jerry Spinazzola Reply

    My Sony desktop has always defragged using the XP home utility until only the past month or so, when I got the “Some files did not defrag” message” and worse, since the report box, which is made not to be maximized in size showed only the start of the file path: docs & settingsname etc. which is all I could see. Printing didn’t help, but after saving the report I found that the stubborn file is a db file used by Google Earth. The full path is Documents and SettingsMyNameLocal SettingsApplication DataGoogleGoogleEarthdbCache.dat. In the past I have always done a disc cleanup followed by a empty recycle bin, then a defrag, which has worked fine. My 80G drive is partitioned C/D from the factory with most space on D due to “Click to DVD” software and the OS is on the 13.97G of the C drive, which had 21% free (3.03G) space the 1st time I got the files not defragged message (and 17% now), which seems to be enough space to double copy the largest file. The report says the Google file is 395Mb, 105 fragments, and the timing seems to coincide with a recent updating of Google Earth to a new version. Windows Explorer shows a 409.6Mb dbcache.dat file & another smaller 2Mb index file. I have an external 250G backup drive also. So, my questions are: Should I uninstall/re-install Google Earth? Is there another available defrag utility I can use if the PageDefrag utility above won’t (will this work-don’t think this file is a paging file?); and will it work on a file of this type? Or should I ignore the issue, since it seems the only slow-down would be when using Google, which does seem to run more slowly even though I have FIOS internet?

  27. Leo Reply

    —–BEGIN PGP SIGNED MESSAGE—–
    Hash: SHA1

    I would ignore it. The effect of having that one file
    fragmented are nearly neglible.

    Leo

    —–BEGIN PGP SIGNATURE—–
    Version: GnuPG v1.4.7 (MingW32)

    iD8DBQFIYZVmCMEe9B/8oqERAkuXAJ4rbbFPRHiN32j0v1i5J3netBB9AQCfT0WP
    I3FOjf2CrRIMYC6v/EKRINg=
    =Bejo
    —–END PGP SIGNATURE—–

  28. Russ Reply

    This is great information, but my issue is slightly different. Yesterday, for the first time, I got the message that some files did not defrag, but NO FILES were listed in the log. In the past, when a file did not defrag, it was listed and I was able to resolve it. Did another defrag today, same issue. Thanks.

  29. Luke Reply

    Hi there!

    I use the windows disk defragmenter on my XP. It only gets to 40% and then comes up with that error message saying that some files could not be defragmented.
    I recently reformated my harddrive (as it was running too slow) and i got this message before (and after) the reformat.

    I have 50% (35Gb) free space on my hard drive…

    Can you offer any advice?

    Cheers!

  30. Penny Reply

    Zipped files won’t defrag. That was the problem when I was getting the same message. May be something to look for.

  31. Leo Reply

    —–BEGIN PGP SIGNED MESSAGE—–
    Hash: SHA1

    “.zip” files defrag just fine. Defragging doesn’t apply to
    the files within a .zip.

    Some files won’t defrag typically because they’re too big,
    or perhaps because they’re exclusively locked by an
    application or by the operating system. For example normal
    defrag programs cannot defrag the paging file – that
    requires extra steps (and it’s typically not worth it
    anyway.)

    Leo

    —–BEGIN PGP SIGNATURE—–
    Version: GnuPG v1.4.7 (MingW32)

    iD8DBQFIf3/XCMEe9B/8oqERAr6LAKCEO8r+AOqTZhZCu/0NmwrYYwwCNwCfSgIt
    DMMomoOMB/Ufn+tZTSv0LnM=
    =AVBI
    —–END PGP SIGNATURE—–

  32. Eternalbodom Reply

    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.

  33. Jim Rowbottom Reply

    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!

  34. Jimmy Moore Reply

    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
  35. ali sherif Reply

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

  36. Robert Newbold Reply

    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.

  37. colleen Wright Reply

    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
  38. Apocalypse-r Reply

    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 =])

  39. BarbaricFellow Reply

    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)

  40. SoloSymphony Reply

    I’ve seen people comment here and there about moving single files or bunches of files from one drive to another to defragment them; through the inherent process, if the destination HDD is sufficiently defragmented (or empty) the files should neatly lay out in a smooth order on the disk platters – that is my understanding.
    I have just under 3TB (yes, that’s Three Terabytes) of HDD space across a handful of External and internal drives.
    With the speed of file transferring over connections like SATA-3Gb/s (yes, even one of my external drives is that fast), being so fast, shouldn’t it be like the holly-grail of Defragging options just to hop-skip-and-jump entire HDD’s worth of data from one drive to another (preferably to an empty or well defragmented one)… automatically defragmenting in the process?

  41. BRENDA BULLARD Reply

    disk def. has detected that chkdsk/f. is scheduled to run the volume. hppalvion
    please check chkdsk/f.

  42. LindyLoo Reply

    My pc has just told me (for the first time since I purchased it several years ago and after many defrags) that it cannot defrag all the files. My pc has 77% free space. I recently downloaded a programme from Nokia, which I later uninstalled because it didn’t to what I wanted it do and also made my pc run slow, and I ran a wash programme I have that allegedly removes any residues left after uninstalling programmes. I only got the “cannot degrag all files” report from the next time I degragged after uninstalling this programme, so wonder if it was that which is affecting it. I ran the defrag again with everything shut down but it still came up with the same message. It says all of the files it cannot degrag are in documents and settingsAll Users Application. I’m not much of a pc expert. Is it worth trying to get these particular files to degrag? Will whatever/wherever they are have any long term impact on the performance of my pc?

    Nope. Not enough of an impact to waste any time on.

    Leo
    03-Jul-2010

  43. swc1971 Reply

    I only have 16% available space (46.64GB used and 8.99GB free). Report told me following: Volume fragmentation info: total fragmentation 15%; file fragmentation 30%. all of them are in my itunes folder. I went in and unchecked read only hoping that would help but it didnt. Do i need to further attempt to defrag this? I have already deleted all the files and programs I feel comfortable deleting to try to free up more space.

  44. Eugen Reply

    Mein Gott! I have 17% fragmented files on my laptop, and all of these fragmeted files (147 fragments!) are on the “System Volume Information”. How can I defragment the System Volume Information? Please, help me.

    Did you try pagedefrag as mentioned in the article you commented on?

    Leo
    14-May-2011

  45. Darlene Reply

    My AVG Internet security 2010 reports that I”m protected and up to date, but windows defender warns that the malware moniter is off. When I update the program it reads completed successfully, and gives a error code. How can I resolve this problem?

  46. gelatogirl Reply

    I have 1 GB free on my laptop’s 136 GB hard drive. This is after I have completely emptied my hard drive of photos, videos, documents, pictures, etc. (moved to external hard drive). I’m not aware of any huge programs on my computer, and it was set to defrag every week automatically. Recently, I tried to defrag manually, and it said I had 70% fragmentation. It took a few hours to go through the process, and when it was finished, it still said I had 70% fragmentation. I know you said lack of hard drive space would reduce ability to defrag, but any advice would be appreciated!

    We’d have to examine which files are still fragmented. Chances are it’s the system files: Why won’t some files defrag?

    Leo
    15-Oct-2011
  47. Mike Reply

    The question for me is “why won’t some files defrag under NTFS?” I’ve been using defraggers since PC Tools Compress v.4.21 (way back in the DOS era–also when dinosaurs roamed the earth) and every FAT-based defragger I’ve used (PC Tools Compress–all versions, Norton Speed Disk, MS-DOS 6.x Defrag, Win9x Defrag–at least in Safe Mode) not only defragmented every single file, but if I wished (and I usually did) it “compacted” the files so that all of the files were together and all of the free space was together (which of course made defragmenting larger files easier). I have mostly been out of the Windows “loop” for the past several years as a Linux user, but dip back into the Windows world now and then. I have yet to find an NTFS defragger that will do what the FAT/FAT32 defraggers could do routinely. They only defrag files to the extent that there is EXISTING contiguous free space to do it with. They don’t move anything to create contiguous free space. And files are still scattered (many of them still fragmented) all over the hard drive.
    Are there NTFS defraggers which will do the complete job like the FAT defraggers have? If not, why not? Particularly, does it have anything to do with the nature of the NT File System? Thanks. Sign me “Baffled”.

    I don’t believe this is a FAT versus NTFS thing at all. The concept is pretty similar on both. What has changed is the OS which is now locking some files in use thus preventing them from being defragged at all. But again, that’s true of either FAT or NTFS. I’m not aware of a tool that not only defrags but moves all defragged files together physically in a single pass (or looking at it the other way: defrag the free space). If it matters that’s typically done by simply defragging multiple times. (I’ve done it and 2-3 times seems to do the trick.) I agree it would be nice, but the files (not the file system) and the way that Windows uses them over time is so much more complex than it was years ago I’d expect the benefits thereof to be somewhat transitory anyway.

    Leo
    06-Feb-2012
  48. William C. CURTIS Reply

    Leo: Remembeer I don’t know what the hell I’m talking about. I’m only a typist with benefits! But since most of us have far more memory than we need why doesn’t M/S program windows so there is routinely a ‘buffer’ between progams for fragmented files? More to this suggestion if you are interested.

    Actually … it does! The real issue is that so many files are being accessed that it’s not always as globally useful as one might think.

    Leo
    17-Mar-2012
  49. Tom Reply

    Just one caveat that should be mentioned with regard to defragging the more modern Solid State Drives (SSD) – Don’t.

    If your hard drive is Solid State, you should get a warning that defragging could damage the hard drive but, just in case you don’t get a warning, check your hard drive type. Perhaps Leo could tell you how to check this.

Leave a reply:

Before commenting please:

  • Read the article. Seriously. You'd be shocked at how many people make comments that prove they didn't.
  • Comment only on the article. If you have a new, unrelated question start with the search box at the top of the page.
  • Don't post personal information. Email addresses, phone numbers and such will be removed.

VERY IMPORTANT: because of a rise an comment spam that's making it through our filters any comments that do not add to the discussion - typically off topic or content-free comments - run a very high risk of being flagged as spam and removed.

If you have a new question unrelated to the article above, ask it on the Ask Leo! ask-a-question page.