In the maintenance of file systems, defragmentation is a process that reduces the amount of fragmentation. It does this by physically organizing the contents of the mass storage device used to store files into the smallest number of contiguous regions (fragments).
Defragmenting is Moving Hangers in your Closet.
As people wear clothing in their closet, they tend to take an article from the rod and leave the hanger in place. As time passes, as you search for the next item you want to wear, the hangers start getting in the way.
Then, when your laundry is ready to hang up, what do most people do? Rather than search through the hung clothing for a single hanger on which to hang one of several items... you find all of the empty hangers and move them to one end. This makes it easier to find space for your clothes.
Defragmenting a hard drive is the same idea. As files are stored, they're placed in empty space as it becomes available. When you delete a file, the space you've allocated for that file is freed (an empty hanger). Finding empty space for your files begins to take longer and longer as time goes on.
When you defragment the hard drive, you move all of the empty space to one part of the disk, making it easier for the computer to find space for new files (and making it easier for the disk to find it later!).livlihood
Defragmenting is Packing a Suitcase
Imagine the storage device is a suitcase. When we pack, when we add something new, we put something into the suitcase. We might also remove something, which is the opposite: we are pulling something out of the suitcase.
Here is a problem we often have: what if we want to add one more big object into the suitcase? We know that the suitcase has enough space to hold it, we have already pulled enough stuff out. The trouble is the space we need is spread out randomly in the suitcase.
What should we do? Reorganize the suitcase! Bingo! This is the time and the reason we need to defragment our storage device as well!watermelonlh