Daddy Bob

DADDY BOB'S COMPUTER Q & A

 

Hard Drive Fragmentation

First, Iíll have to explain a little about how a hard is laid out and stores your data. The easiest way to do this is to make comparisons with something everyone is probably familiar with. So, Iíll start out by comparing the hard drive to a large building like a warehouse.

When the hard drive is first bought, it is like the newly built warehouse, pretty much empty in side. It has to be prepared to hold whatever it is you are going to store in it. In the warehouse, we will lay out many rows. In each row there will be shelves from top to bottom, and in these shelves we will create bins that will hold the product. For this comparison, all these bins will be the same size.

Compare this to the hard drive where the rows become tracks, the shelves become cylinders, and the bins become sectors. In the case of the hard drive, each of these sectors is the same size capable of holding 512 bytes of data. This general layout is created on the hard drive by a process known as formatting.

When a hard drive is formatted, the tracks, cylinders, and sectors are laid out magnetically on the hard drive. As in a new warehouse, where all the new bins are completely empty, so it is with the hard drive, all the sectors are empty. This is why re-formatting a hard drive destroys or removes all previously stored data.

Now, to keep track of where the stuff is stored, we need an office where the files are kept. In the hard drive this is called the directory or catalog. If we place this office in or near the center of the warehouse, we will have access to more of the storage space all around the office than if it were placed at one end. The same thing goes with the hard drive. The directory is placed near the center so the distance needed to travel to the data is shorter and therefore takes less time to get there and back.

In the warehouse we use men, trucks and other handling tools to store or retrieve the items. In the hard drive, we use the ďread/writeĒ heads to go back and forth between the directory and the sectors to either get (read) data, or store (write) it.

When a loaded truck comes into the warehouse, there is a bill of lading that tells what is in the truck, how much it weighs, and the warehouse man calculates how much space will be require to store it. The warehouse man then allocates a number units required to hold the items. To make it easier to keep track of, there are always the same number of bins in each allocation unit.

The size of the allocation unit will vary with the size of the warehouse. If the allocation unit contains 50 bins, but only 40 are actually used, then the other 10 are wasted, and never available for use. Therefore, the smaller the size of the allocation unit is the better.

Compare this to the hard drive, the allocation unit becomes the cluster, so all space allocated on the hard drive is done by the cluster. Now, if the cluster contains 50 sectors but only 40 are actually used, then the other 10 are wasted and never used. So again, the smaller the size of the cluster is the better.

Finally, Iíll get to fragmentation. In the warehouse, new items are being received and sent out all the time. In the hard drive, new data is being written and read all the time. To keep things as manageable as possible, space is always allocated for new arrivals starting as close to the office/directory as possible, then outward from there.

When the first shipment comes in it is decided that 10 units will be needed and the items are stored in this area. The next shipment has units allocated the same way and is stored next to this, and so on until the warehouse begins to fill up. In the hard drive the incoming data is stored the same way, starting at the directory and moving outwards. So far, so good and no problems.

Now, from time to time, items are removed leaving empty bins. These are marked in the office as being available. In the hard drive, data is erased or deleted, and the sectors are marked in the directory as being available. For the sake of this example, weíll say that there are now 10 empty bins/sectors available close to the office/directory when in comes a new load that will take 30 bins/sectors.

The 10 bins are allocated here first being closest to the office, and then the search goes on for the next available 20 bins. These may be scattered all over the warehouse. The same goes for the hard drive. The available sectors closest to the directory are allocated first, and then the remaining ones are allocated from there. This causes the data to be stored in non adjacent areas, and it is said to have become fragmented.

The more that the drive is used; the more data is written and erased, the more it will become fragmented. Compare the hard driveís read/write head to being a warehouse man with a small hand truck, and a short memory. He checks the office, finds the first bin and goes to it and gets the items. In this bin, the location of the next  bin is kept, so it is obtained and then the man goes there. These items are collected, the location of the next bin is found, and this continues until all the required items have been collected. 

This constant traveling, which can be back and forth all over the warehouse takes time. The more scattered the items are the longer it takes to get them all. In the hard drive, the small hand truck is compared with the hard driveís small read/write head. The more traveling it has to do, moving from sector to sector to get the data, the longer it takes to retrieve it.

After days, weeks, and months of use, this constant saving and deleting data of different size files will cause the hard drive to become very fragmented. Even if you donít think that you are saving or deleting that much manually, the computer and the applications it runs are doing this constantly. Just take a look at the hard driveís light on your computer, and you will see it flashing frequently when you are not doing anything.

The more fragmented the data is the longer it takes for the hard drive to retrieve it. So, the solution is to defrag the hard drive. Defragging moves all the separated segments of a file to one place so that it becomes contiguous. (Defined as Sharing an edge or boundary; touching; neighboring; adjacent; connecting without a break.) This reduces the amounting of traveling necessary, and makes it faster for the read/write head to find and retrieve the data.

In modern computers with their fast CPUs and memory, the one still slow bottleneck is the hard drive. Therefore, anything that speeds up the hard drive's function will enhance the overall computerís performance. Fortunately, Windows 7 does this automatically, so manual defragging is not required.

WARNING!!

Defragging is extremely stressful on the hard drive and although hard drives are built to take a lot of stress, too much manual defragging is definitely not advised. With the newer hard drives, the actual benefit may be marginal at best. SSD (Solid State Drives) should not be defragged ever.

Click HERE to view or download this article in a MS Word format.

Disclaimer:

The materials in this site are provided "as is" and without warranties of any kind, either express or implied. To the fullest extent permissible pursuant to applicable law, I disclaim all warranties, express or implied, including, but not limited to, implied warranties of merchantability and fitness for a particular purpose. I do not warrant that the functions contained in the materials on this site will be uninterrupted or error-free, that defects will be corrected, or that any site or the servers that make such materials available are free of viruses, spyware, adware, or other harmful components, although all efforts have been made to assure that they are. I do not warrant or make any representations regarding the use or the results of the use of the materials on this site in terms of their correctness, accuracy, reliability, or otherwise. You assume the entire cost of all necessary servicing, repair, or correction. Applicable law may not allow the exclusion of implied warranties, so the above exclusion may not apply to you.