Just wondering if defragmenting your hard disk is any useful and if there have been any studies on this topic. I believe it is quite useless as I never noticed any improvement.

Preconditions:

  • The disk is the average hard disk found in ~2010 computers
  • The OS is modern (no DOS 1.0)
  • The disk wasn't artificially fragmented, but was fragmented with typical computer usage
link|improve this question
3  
This belongs on SF – DVK Jun 4 '11 at 12:29
1  
While I was under the impression that defragmenting will have no benefit on solid-state hard drives, others have demonstrated otherwise e.g. lagom.nl/misc/flash_fragmentation.html – Brian M. Hunt Jun 4 '11 at 13:08
1  
@Brian M. Hunt, that is an SD card, not an SSD. SD cards typically have straight 512 byte erase blocks, and no internal wear leveling, which would also tend to indicate that his results are due to other factors since his premise assumes that the fragmentation is crossing the boundaries of the much larger erase blocks that are typical of SSDs. – psusi Jul 8 '11 at 15:22
1  
It's not the disk, which gets fragmented, it's the filesystem. I have multiple filesystems on my disk, and they don't get fragmented, because they're modern OS (=linux) filesystems. I don't know for Mac, but Windows and Dos filesystems (FAT/VFAT) fragmented in earlier times. Do they still? The non-fragmenting reiserfs is out since more than 10 years! – user unknown Jul 21 '11 at 2:13
1  
@DVK: belongs on SU, not SF. – vartec Dec 2 '11 at 13:29
show 4 more comments
feedback

2 Answers

The goal of defragmentation is to reduce amount of random reads/writes vs sequential read/writes. It organizes files to be on the consecutive sectors of the disk.

sequential vs random

I case of spinning HDDs, random access means there are two latencies involved. First the head has to move to the right track (seek time), then it must wait till the sector to be read spins into the position (rotational latency). In case of sequential read there is no need to change track and the sector you're going to read is just the next one, thus both latencies ar eliminated.

enter image description here
source: MS TechNet

Now how big is the performance hit on sequential vs random? Let take recent Seagate Barracuda as an example:

enter image description here
source: Storage Review

So the answer is obvious. More fragmented the file system, more random seeks you have to do.

BTW. most modern file systems try to reduce fragmentation when creating new files. So for typical use fragmentation might not be real issue, unless you got your disk to be almost 100% full.

link|improve this answer
1  
So these numbers are completely artificial, and not from typical computer usage. In other words: off topic for the question at hand, which is about practical usefulness. – user unknown Dec 3 '11 at 4:04
@userunknown - The answer is it can. There are still quite a few computers out there with smaller <250g hard drives as their primary drive. These drives are still prone to fragmentation (because with swap and temp files they fill up). Some people partition their OS away from data on the same drive. This used to speed up (in the days of IDE && FAT16/32) the system access. But the smaller partitions are more prone to fragmentation. So the old technique for improving performance is counter productive on modern drives. – Chad Dec 5 '11 at 21:52
@Chad: The fragmentation does not depend on the absolute size of a hard drive, but from the relative filling and the probability of new files exceeding free space chunks. But that's a complete different topic. Fragmentation will normally not lead to situations, where you have to write a 500MB file in 1000 pieces of 512k or in pieces of 4K. – user unknown Dec 6 '11 at 0:23
1  
@userunknown: can you prove that? extreme fragmentation will lead exactly to that. – vartec Dec 6 '11 at 9:15
1  
@userunknown - Please show any proof for "People who need big drives buy big drives, and people who don't fill their drives up keep their small drives". Everything else has been a clarification and explanation of the data above. This is a new claim that requires reference. The question is not will it help you. It is "does it improve performance?" The answer is it does in certain cases. – Chad Dec 6 '11 at 16:38
show 4 more comments
feedback

We know it improves seek times since the disk head is on average closer to the next block of data it needs to read. Data on the outside edge of a disk can be read more quickly because while the rate of spin is constant, more sectors are on the outside edge of the disk and so the average seek time is smaller. This fact can also be taken into account when setting up a partitioning scheme. See http://partition.radified.com/partitioning_2.htm

Whether this is going to give a noticeable improvement depends on the applications you are running, how they access the disk, and what resources other than disk I/O the application uses. In general applications bound in disk I/O can see an improvement while applications bound in Network I/O or CPU will not see much improvement.

http://stackoverflow.com/questions/868568/cpu-bound-and-i-o-bound

link|improve this answer
6  
"We know it improves seek times" - No we totally don't. It might improve I/O bandwidth (not seek/latency) because (after finding the start of the file) the entire file can then be read without further seeking. – ChrisW Jun 4 '11 at 12:16
ChrisW it also improves average seek times because it will move data towards the outer edges of the disk. – Jeremy Jun 4 '11 at 12:43
1  
@Jeremy I don't know that makes a difference. Seek time results from from waiting for the platter to spin (i.e. to arrive under the head): and the outer edges of the platter spin exactly as much as the centre of the platter (same number of RPM rotations per minute). – ChrisW Jun 4 '11 at 12:46
I have to agree with @Chris, but otherwise I think it summarizes the issue pretty nicely. I'd also add that it's not just apps dealing with large files, but filesystem-bound tasks in general. I noticed improvements when compiling ( many small files ) and Photoshop - medium sized files. – Mihai Rotaru Jun 4 '11 at 12:48
2  
@ChrisW: The disk spin is constant but the outer edges have more sectors, so the average seek time at the outer edges is significantly faster since more sectors move relative to the disk head. Some people use partitioning schemes designed to take advantage of this fact: partition.radified.com/partitioning_2.htm . – Jeremy Jun 4 '11 at 14:50
show 11 more comments
feedback

This post does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.

protected by Sklivvz Dec 2 '11 at 11:00

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

Not the answer you're looking for? Browse other questions tagged or ask your own question.