As a computer is used its files become fragmented. In other words a single file can be stored in pieces in multiple locations on the hard drive. This is what “Random Access” means.
Whenever a new file is added to the disc, the operating system determines where the first empty spot on the disc is and starts to write the file. If that spot isn’t large enough, it continues to write the remainder in the next open spot or spots. It puts “directions” to all these locations in a directory so that when called for, the entire file can be accessed. Multiply this by hundreds of thousands of files and you have a fragmented disc. The fragmentation is invisible to the user.
However it is very visible to the operating system. As more files become fragmented the system begins to slow down. It takes longer for programs and files to load as the system tracks down all its locations. In severe instances programs can even cease to work altogether. A defragmentation process, or “defrag,” will find all the pieces of all files resident on a disc and rejoin them in a contiguous place on the hard drive as well as keeping all the free space together. It then compacts the files to keep them from becoming fragmented again.
Some defrag programs go even further and attempt to put all files in smaller directories together, since they are accessed sequentially most of the time. The read/write heads will therefore have limited movement in order to access all needed files, speeding their processes.
So why are there small empty spaces on the drive in the first place? Why isn’t everything stored contiguously from the start? Well, it is. But over time, programs get deleted. User files become larger or smaller, forcing different storage tactics. Computer programs themselves may increase or decrease the size of files, creating empty spaces or forcing part of a file to the end of the used space where empty space can be found.
The defrag process is memory intensive. It must take files and move them around, often multiple times, within the free space available. If the drive is full, a defrag cannot be performed. It’s a good idea to run it overnight or some other time when the computer isn’t being used. If it hasn’t been done in a long time, it could take hours to complete. Done regularly it shouldn’t take long.
Note that the directory structure is in no way affected by a defragmentation. The user is unaware of any change, with the exception that loads may be noticeably faster.
A hard drive should be defragged about once a month for most computers. Defrag programs come with operating systems and can be set to run automatically at set times each month. A disc system needs to work very hard to retrieve and work with fragmented files. Regular defrag will extend the life of a hard drive significantly.
Leave a Reply