• ARTICLES
SEARCH

How-To Geek

What Is Disk Fragmentation and Do I Still Need to Defragment?

Do modern computers still need the kind of routine defragmentation procedures that older computers called for? Read on to learn about fragmentation and what modern operating systems and file systems do to minimize performance impacts.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-drive grouping of Q&A web sites.

The Question

SuperUser reader Simon Sheehan is curious about the state of defragmentation in modern drives:

As a part of regular Windows maintenance, I defragment my hard drive. But why does the hard drive fragment on NTFS and FAT* systems? Apparently EXT* does not, why is this? Should I also be defragmenting my USB drives?

Let’s turn to some of the contributor answers to investigate Simon’s question.

The Answer

SuperUser contributor Daniel R. Hicks fields the question:

Fragmentation is not the issue it was 30 years ago. Back then you had hard drives that were scarcely faster than floppies, and processor memory sizes that were minuscule. Now you have very fast drives and large processor memories, and sometimes substantial buffering on the hard drive or in the controller. Plus sector sizes have gotten larger (or files are allocated in larger blocks) so that more data is inherently contiguous.

Operating systems have gotten smarter as well. Whereas DOS 1.x would have fetched each sector from disk as it was referenced, a modern OS is able to see that you have a file open for sequential access and can reasonably predict that you’ll be fetching additional sectors once you’ve consumed those you have now. Thus it can “pre-fetch” the next several (dozen) sectors.

And any more it’s often better to not have a file contiguous. On a (large) system where the file system is spread across multiple drives a file can actually be accessed faster if it is “spread” as well, since multiple disks can be seeking the file simultaneously.

I defragment every 2-3 years, whether my box needs it or not.

[I'll add that the important thing is not so much whether the data on the disk gets defragmented as whether the free space does. FAT was terrible at this -- unless you defragged things kept getting worse and worse until there were no two contiguous blocks of free space. Most other schemes can coalesce free space and allocate pieces in a somewhat "smart" fashion so the fragmentation reaches a certain threshold and then stabilizes, rather than getting worse and worse.]

Journeyman Geek adds in the following information about Linux file systems:

ALL file systems fragment. ext and other Linux file systems fragment less due to the way they’re designed – to quote Wikipedia regarding the Linux Network Administrators’ Guide:

Modern Linux filesystem(s) keep fragmentation at a minimum by keeping all blocks in a file close together, even if they can’t be stored in consecutive sectors. Some filesystems, like ext3, effectively allocate the free block that is nearest to other blocks in a file. Therefore it is not necessary to worry about fragmentation in a Linux system.

I’d note though that ext4 has online defragmentation so eventually fragmentation IS an issue, even with Linux file systems.

Windows file systems have their clusters placed wherever there’s space to put them, and defrag runs around and replaces them. With Linux, files are preferentially placed where there’s enough space.

I’d note though, Windows 7 has scheduled defragmentation runs, so it isn’t really necessary to run defrag manually.

One element of the original question that wasn’t addressed is whether or not you should defragment your flash drive. Defragmentation is a very reader/write intensive process and should be avoided on solid-state storage devices like flash drives and Solid State Disks (SSDs). For more information on defragmentation, file systems, and SSDs, check out the following HTG articles:


Have something to add to the explanation? Sound off in the the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

Jason Fitzpatrick is warranty-voiding DIYer and all around geek. When he's not documenting mods and hacks he's doing his best to make sure a generation of college students graduate knowing they should put their pants on one leg at a time and go on to greatness, just like Bruce Dickinson. You can follow him on if you'd like.

  • Published 12/13/12

Comments (20)

  1. thomasclover

    If your external drive has platters then it really depends on what you use it for. Mine are just for backups which are only accessed during my weekly backups and backup tests. No real need to defragment there. If you use your external hard drive for any activities that result in a lot of file changes (writes to the plattes) then you should include defragmentation as a part of your routine maintenance. There is one caveat to remember. Make sure you have a good backup before manually defragmenting a removable drive. One good bump or accidentally unplugging it can result in data loss.

  2. theeo123

    There is a proven performance game **in specific cases** from defragmenting

    your average run of the mill mail & web users won’t notice a difference

    Heavy downloaders (say several gigs a day or more) and intensive gamers however, can pick up some performance boost

    this article is a little old but useful – http://hofmannc.de/defragxp/index_en.html
    The test system has a 3Ghz CPU 4 gig of Ram, and the VERY VERY thurough testing conditions compared various defrag software, the Windows built in defrag tool and an untouched drive, comparing things such as start up time,s browser load times, office apps, photoshop operations performances game benchmarks etc.

  3. BigTech

    If you have a SSD you do not need to defragment. Otherwise. defragment and optimize once a month or so. It is important to not that there are 3 basic levels of file data management: Consolidation, Defragmentation and Optimization. The later being the former plus.

    Consolidation or Free-Space Consolidation is the lowest level and just clusters the data and the free blocks together. The files remain fragmented and honestly there’s no real benefit from it these days.

    Defragmentation: Is what we’re most familiar with where all the blocks belonging to a file are clustered together for faster access. Although drives have gotten faster this still makes a heck of a difference if you work with files above 100mb regularly and more so if you work with 1gig plus files. It also performs Consolidation.

    Optimization: This is the ultimate when done properly. A Consolidation and Defragmentation is performed and in addition the files are positioned on the drive in a manner that allows for faster access. Frequently accessed files typically on the outer rings of the platter, while the rarely accessed are on the slower inner rings. System files and OS files typically in the middle rings. This means you will have unconsolidated free space but the system will be more responsive.

    Optimization should be run at least once every three months , a defragmentation should be done at least once a month. You never need to do a barebones consolidation these days.

  4. bemymonkey

    Spinning storage drive? No need unless storing very small files.

    SSD system drive? No need, random access is fast enough.

    Spinning system drive? Defragment that sucker at least once a week, or at least leave Windows 7′s default defragmentation schedule intact. Yes, hard drives have gotten faster and pre-fetching, NCQ etc. help a little, but when your average office desktop system with 2 or 4GB of RAM starts swapping to disk, the difference between a fragmented and defragmented system drive is like night and day.

  5. bobro

    I always used to defrag after a reinstall, after i had put all my data back and reinstalled all my programs, and it used to always need defragging heavaly… but since windows 7 i noticed that after my faffing the defrag came back almost perfect, months down the line it is still pretty perfect…

    now i have an SSD and to hell with defragging!!! :)

  6. Tim S

    If you have an SSD you should *never* defrag it – you are just wearing out the drive for no gain whatsoever. The only thing important for SSDs is TRIM support which both 7 and 8 have by default.

  7. shazzer

    wha\ts SSD

  8. OldSalt

    SSD = Solid State Drive. It uses integrated circuits as memory like a flash or thumb drive. No moving parts and data access is electronic vs electromechanical of a Hard Disk Drive (HDD).

  9. harv

    Defragging your Page File often brings spectacular results. Easiest way, turn it off, reboot and turn it back on.

    Ordinary defragging often works better if you turn off both the Page File AND Hiberfile.sys first. Remember to turn them back on afterwards.

  10. RangeRyder

    There is sanity in defragging. Having seen numerous slow computers from I7′s to dual cores, to Pentiums and AMD’s.Defragging does and will make a difference in the speed of a computer

    However, just defragging does not insure the speed performance. My “customers” are general users, not gamers. There is nothing special about their machines, they buy it, use it and only when I suggest, order and install it – memory added.

    All my “machines” get a three+ step tune up. First, CCleaner to remove garbage and then to remove left overs in the registry. Second, depending on the operating system, clean out all the restore points, etc.

    Take a quick peek at MSCONFIG… do some cleanup and a quick check in REGEDIT for startup items and actually check the start up folder.

    Third, using defraggler , run it. when its finish defragging, restore the restore and create a restore point.

    What do I give my “customers” is an average boot speed improvement of 50 – 70%. And average internet access speed improvement 25 – 50%. Average application speed improvement up to 50%.

    Value of doing this, priceless.

    And yes, I leave them instructions on how to do some of these items and more.

  11. Art€

    Like @RangRyder, I’ve been doing exactly the same for years. But instead of using CC cleaner I use Glary Utilities (just find it dead simple to use) to clean all the ‘sh*te’ out of the registry, then defrag the registry, clear out all old stuff in the ‘recycle’ bin then lastly do a Defrag using Defraggler and I DO get much better performance!!

    Of course my thumb drives & SSD’s I leave well alone!! B-)

  12. mike

    So far I have seen several articles about this topic. And some of them talk about solid state storage. It seems to me that SSD is nice, but you get rid of computers so quickly keeping up with the unholy alliance of hardware and software that it is almost moot. If you have hard drives you can go the whole life of a PC and only “need” to defrag a couple of times. (Yes, I know it should be done regularly once a month, but most people don’t)

    With the turn over so high the real question is what do I need to do, will this device do it and plan on getting its replacement in a year or two.

  13. Richard Steven Hack

    If you’re using NTFS, yes, you should defrag. Windows will tell you so if you run the defrag utility. You might not notice a huge speed improvement, but it does help with either a lot of small files, or with huge video editing files, such as when you’re capturing video or film.

    If you’re using Linux file systems, forget about defragging. I’ve never defragged my Linux boxes.

    The easiest way on Linux if you ever notice a serious slowdown (highly unlikely) is simply to copy all the data out to an external drive, then reformat the data partition and copy it all back in again (you are doing backups to an external drive, right?). Do it overnight. Everything is now defragged.

    I’ve never done that but whenever I upgrade a hard drive to a new drive, of course it gets done automatically in the process of copying the old drive to the new – if you don’t “clone” it, or copy an image file, of course. Normally, you wouldn’t clone it because the new drive partitions are usually bigger than the old, unless the clone utility you use automatically expands the old data partition to fit the new one. So better to copy the data manually so it’s all copied contiguously.

  14. Don

    I don’t know if this is normal but I ran a defrag program, then I ran another (they were both well known programs) and at this point, my computer was hosed. Had to reformat – reinstall Win XP Pro at this point.

  15. George

    Thank you for the great info! I am “techno impaired” as far as computers go, so any info is good to me!

  16. WuzntMe

    @ DON

    Did the same thing, including needing to re-install.
    Didn’t find any info on it.
    (Name and Address withheld)

  17. MikeMoss

    Hi

    I work with large 3D video files, and I can see real improvement when I defrag these files before editing them.

    I’ve seen it make the difference between completing the process and not.

    I use Defraggler because you can chose to defrag just the files without doing a complete redo of the intire drive.

    It usually only takes a few minutes and I do it daily.

    Mike

  18. Jason G

    I’ve been trying to answer this question since the early days of XP. I’ve tried all the major defrag apps, and some you may not have heard of. They all offer their own take on optimization, defrag, consolidation. Thing is, I’m seeing less and less performance gains. Really, unless your drive has been in use for a long time, or you work with large files (such as virtual machine-related files), you probably won’t see as much of a difference as you would if you just kept all the junk cleaned out. Trim your start up programs, get rid of useless apps. Don’t even touch the registry unless you know what you’re doing. I have a laptop with 8gb of RAM and a 320gb hard drive, Intel Core I5 processor. I rarely noticed a performance lag unless I’m working heavily with VM’s. Honestly, the hardware is what makes more of a difference. Defragging is still useful, but I don’t see the point in spending money on defrag apps anymore. Let Windows do it’s thing, maybe tweak the schedule to your convenience. Turn off Index and System Restore (IF) you have a solid back up plan, and don’t often search for files. You’ll see some minor gains there. Otherwise, if it’s not broken, don’t try to fix it. :)

  19. Keith Schmidt

    harv said (correctly):
    Defragging your Page File often brings spectacular results. Easiest way, turn it off, reboot and turn it back on.

    Ordinary defragging often works better if you turn off both the Page File AND Hiberfile.sys first. Remember to turn them back on afterwards.

    (Keith adds: I always defrag my drives in safe mode which loads minimal drivers. You can do this by pressing the “F8″ key during bootup.

    Keith adds: I saw mentioned that you don’t need to defrag SSD drives but I don’t recall anyone saying that you should NEVER defrag an SSD drive! SSD drives, although lacking moving parts, still have a limited lifespan. Defragging does no good and will cause the drive to fail more quickly.

    ‘SSD lifespans are usually quantified in the number of erase/program cycles a block can go through before it is unusable, as I mentioned earlier it’s generally 10,000 cycles for MLC flash and 100,000 cycles for SLC.’ (Anand Lal Shimpi said this, but I don’t want to link in case the system filters my post)

    Now I, the author of this post adds, the larger the files you deal with on a daily basis, the more benefit you will obtain from defragging. Defragging the page file and hibernation file makes sense. I’m not sure if this is done automatically in safe mode or not)

    Bootup times will benefit from defragging, but not on a regular basis unless you regularly install various operating systems.

    Defragging in safe mode is better because defrag programs can’t rearrange the blocks of programs that are in use.

    Lastly, defragging does allow you to access files more quickly because the read/write head doesn’t have to move back and forth across the platter to get all the needed blocks.

    My personal opinion is, if you have the funds and use the computer a decent amount, get a drive that’s 7200 rpm instead of 5000rpm. The cost difference is worth it. If you’re a gamer and have the cash, the 10,000 is worth it. I get by just fine playing an MMORPG with a 7200 rpm though.

    *** Get more memory for your computer! I know people that do this constantly and don’t understand:
    If you have 4Gb of memory but 8Gb of programs “open”, Windows will use a swap file (it’s called a “page” file) to swap the program least used to the hard disk. Windows uses the hard disk as “pretend memory”. This “pretend memory” (the “page file”) is slower than memory chips inside your computer. The more memory chips/the larger memory chips that you have, the more programs you can have open at one time without Windows having to use that slower hard drive as “pretend memory” (call it “temporary memory”, “swap memory”, “swap space” or whatever you want).

    If you read this whole post, I appreciate it. You’d make a good parent. You have the patience of a saint! :)

    Keith

  20. SuL

    I defragged my wife last nigt.

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!