Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What does disk defragmenting do?

  1. Mar 7, 2013 #1
    Turns out that my HDD and SSD are badly fragmented as they have never had a defrag run on them in more than two years. So someone recommended that I run a disk defrag.

    What exactly does this do? Will it make my computer run faster?
  2. jcsd
  3. Mar 7, 2013 #2
    This is what it does. It will speed up all processes that require file reading/writing and that's a lot.

    However when it actually runs, it tends to slow down the computer. So it might be helpful to have it run on command, when you're not busy yourself.

    Some alternatives.
  4. Mar 7, 2013 #3
    See if you have any large specific file intensive task that you actually regularly do and which doesn't require finger input while running. Save your original data. Time the task with a stopwatch. Defrag your drive. Then time the task on the original data again. Then please, please, post the results here.

    There is folklore that one decibel is about the minimum relative change that a person can detect, unless they are doing the two tasks side by side so they are subtracting rather than actually estimating the time. Google

    decibel just noticeable difference

    It is my guess that almost nobody will ever see at least a decibel decrease in real actual honest non-contrived work time from defragging their drive. I'd love to see good data on that.
  5. Mar 10, 2013 #4


    User Avatar
    Science Advisor
    Homework Helper

    I agree there is a lot of BS talked about defragmentation, but that is a very poorly designed experiemnt because it doesn't measure how fragmented the drive was beforehand, and unless the data files are significantly larger than the RAM size, most of the data access will be cached in RAM so the disk speed is irrelevant.

    On the other hand if you DO have a data-intensive application that continuously accesses data randomly from a large database (hundreds of GBytes) in real time, and where delays of a few milliseconds are obvious without using a stopwatch, quite likely you will see the effect. One such application is computer music generation using a sound sample library. (Of course you don't so much "see" the effect as hear it, as glitches in the audio being generated).

    The standard recommendation used to be to defrag the drive before installing the sample lilbrary, to ensure there was a contiguous free area of disk big enough for all the data. But these days, a better solution is to use a solid state disk, where the data transfer rate is only limited by the capacity of the data cables, not by the mechanical design of the disk drive.
  6. Mar 10, 2013 #5


    User Avatar

    Staff: Mentor

    Does it make a sense to defrag SSD at all? Internal data structure has nothing to do with what we see from the outside.
  7. Mar 10, 2013 #6
    And how would anyone tell a novice, or most other folks for that matter, to carry out an excellently designed experiment in this?

    My only goal was: X asks if defrag will help him. I tell him to time it before and after and get some actual concrete numbers that show whether it did or not. (And if you have a "hundred gigabyte audio file" then you have much bigger problem that I could ever hope to address)
  8. Mar 10, 2013 #7
    I have a 128GB SSD with three games installed on it.

    Battlefield 3 with all of it's expansions (over 50GB of space)
    Diablo 3
    Fallout New Vegas

    This drive was 35% fragmented before I ran the defrag. Will this make the games I have installed on it run faster?
  9. Mar 10, 2013 #8
    That is very high fragmentation. Theoretically, but you may not notice the difference. Maybe it speeds up loading by 4%. That is nice, but you may not really notice it.
  10. Mar 10, 2013 #9


    User Avatar

    Staff: Mentor

    I will ask again: does the defragmentation of SSD make any sense? I know the logic behind HDD, but SSD?
  11. Mar 10, 2013 #10


    User Avatar
    Gold Member

    As far as I have read defraging an ssd will have a minimal effect on speed and because it will cause loads of write accesses to the drive it will shorten the life of the drive.

    TRIM is the ssd equivalent of defragging: http://en.wikipedia.org/wiki/TRIM
  12. Mar 10, 2013 #11


    User Avatar
    Homework Helper

    I do partition backups via a file / folder copy from a partition to a folder on another hard drive. In this case, defragmenting saves a lot of time. Since the program I created to do the file / folder copy does this in directory tree order, (all files within a directory as a group), then if I do a backup / verify / format / restore / verify, then the restore and any later backups will go much faster as it's almost all sequential I/O operations. This works for Windows XP (using another instance of OS to do the backup), but not for Vista and later (my program doesn't handle junction points yet, but there may be additional issues I'm not aware of). (Note, I also save and retore partition volume id's of partitions since a quick format changes them, which can trigger re-activation or re-install issues).

    In the case of a Windows 7 or 8 image backup, defragmentation wouldn't save that much time. I'm not sure if there are any file / folder oriented backup applications available for Windows 7 or 8.
  13. Mar 10, 2013 #12
    It won't let me defrag my hard drive partition for some reason. :confused:
  14. Mar 11, 2013 #13
    Does it give you any information about why not?
    Or does the information it gives just not make any sense to you?
    Is your drive more than 90% full? Sometimes that is a reason for Defrag quitting.
    Are you using Windows and the built-in defrag?
    Have you used or considered the free
    instead? It warns about nearly full drives, but you can tell it to go ahead and do a less quality job anyway.
  15. Mar 11, 2013 #14

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    If your drive is very badly fragmented, it might not be possible to defrag it in-place. Defragging moves file segments around, and it needs contiguous blocks of empty space in order to do this. Defragging a highly-fragmented drive is somewhat like playing Towers of Hanoi.

    You didn't tell us the error you're actually getting, but if the cause is over-fragmentation, then the only real solution is to copy the data elsewhere, wipe the drive, and copy it back so it will be all neat and tidy. However, as others have pointed out, whether this is actually worth doing is questionable.

    Defragging your games drive will not make your games run faster. It might make loading times slightly faster, but that's all.
  16. Mar 11, 2013 #15
    SSDs have a limited number of cycles and formating one won't make a significant difference so it is almost always considered counter productive. People who need more speed can buy SSDs that plug into a pci-e slot for faster data transfer rates.
  17. Mar 11, 2013 #16
    No, I have a 2TB HDD and a little more than 100GB of data stored on it. Mostly photographs, music, and miscellaneous software.

    My 128GB SSD has battlefield 3 (with all of it's expansions) Diablo 3, and Fallout New Vegas.

    It is more than 60% full.
  18. Mar 11, 2013 #17

    So start your defrag program of choice, select the 2TB HDD, click Start and then tell us
    1. What defrag program you are using, who made it, what brand is it.
    2. Did it start defragging or not.
    3. If it did not then exactly what did it tell you.

    It is sometimes difficult for a person with a problem to think in a way that they then realize the people on the net hundreds or tens of thousands of miles away cannot see what is on your screen or what the minutes or even months of work have done or not done or what is in your head.

    It is very difficult to tell from all the things that you are not telling anyone about this that you tried to defrag the SSD. Perhaps the defrag program is smart enough to simply refuse to defrag SSD drives.

    First, that sounds like you did successfully defrag the drive. True?
    Second, since I think some or maybe most gamers are fascinated by whether they are getting 54.13 frames/second or 55.26 frames/second and since you have the game in front of you, tell us, what was the old f/s and what is the new f/s. That is going to be much easier for you to tell us than it is for anyone to psychically remote view your computer and tell you those numbers.
    Last edited: Mar 11, 2013
  19. Mar 11, 2013 #18


    User Avatar
    Science Advisor
    Homework Helper

    Hmm..... I once was involved in a project to answer a similar question (not specifically about defragging, but how to get the maximum disk transfer rates for an application).

    We had both the computer manufacturers and the software developers involved. Since they were trying to sell us the system on the basis of its performance, they were quite interested in the results we were getting (or not getting).

    We spent about four weeks getting to the stage where the numbers we were measuring didn't look like random noise. But after that "success", we didn't get anywhere much towards finding the "best" setup, though we did find a few ways NOT to configure the system.
  20. Mar 11, 2013 #19


    User Avatar
    Homework Helper

    If you have a process where the order that files are read or written in is a known order, then placing those files on a disk in that order will result in the streaming transfer rate from the disk drive, except for the overhead of accessing the cluster information for the files. One example of this is the file and folder copy operation that I use to backup partitions from one hard drive to folders on another hard drive.

    At one company I worked for, we wanted to be able to boot from tape, and to simplify this operation, we added a monitor to check the file order during a boot process, and the duplicated that order on the tape. Some files got read more than once, so we have duplicates of those files on tape, so that the boot process was a streaming read from tape without any random access. The additional cleverness was allowing the command interpreter to read it's batch / script lines from the tape, so what ended up on the tape was a booter, command interpreter, then a stream that alternated between batch commands, programs, and data files.
    Last edited: Mar 11, 2013
  21. Mar 18, 2013 #20
    I used to defrag religiously back in the early 1990s but haven't done it but twice in the last decade.

    I notice no performance degradation because of the nature of what I do.

    Other uses will be greatly improved by defragmenting such as on my digital audio workstation or anything that requires a good and uninterrupted high sustained data transfer rate.

    Sadly, some files "grow" which causes a huge amount of reorganization if they had been previously moved into a space between immovable system files.......and defrag decides they will fit better elsewhere.

    Proper defragmentation starts right after you finalize your operating system installation and continues throughout the life of the system on the disk.

    There are other things you have to consider such as whether you make your swap file static or not so your defrag strategy will change depending on what you are doing with your computer.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook