What is Defragmentation and how long does it take?

Disk Defragmenter is a utility present in Microsoft Windows which is designed to increase the disk access time by rearranging the files stored. It tries to store all the data in contiguous storage locations. The main aim of defragmentation is to reduce the head travel time (this is the time your disk drive takes to point to a target location and is in a ready state to access it).

Starting with Windows Vista, the Windows Disk Defragmentation has been much improved and is considered better than its predecessor. The Disk Defragmenter runs a low priority task in the background without affecting the performance of the computer. In most of the cases, the defragmenter only runs when your computer is idle.

Why do we need Disk Defragmentation?

Let’s speak in more common terms. When you erase a file from your computer, its space is marked free. When you save a file, it’s put in the first available free space. If that free space isn’t big enough to accommodate the file, the file is broken down. Some of it is stored there while the remaining part is saved in the next free location. However, some operating system doesn’t do this at first. If there is space on the disk which has never been used, it preferably saves the file there. This means that your entire drive becomes filled with empty spaces.

Defragging your disk is the process of eliminating all random free spaces, then collecting all the files and saving them in contiguous blocks of memory. This makes file retrieval on your system much faster.

Your hard drive consists of a head from which it reads the data. The operating system has a mapping of all the files and where they are saved. It directs the head to a specific location and accesses the data saved there. The head must then traverse through the disk to that location and read the data. Now imagine if the drive on your computer had files saved with many spaces in between. The head would have to change its location again and again to read a file. This will effectively increase the file access time. Disk defragmentation tries to eliminate this extra time taken.

What are the mechanics of Disk Defragmentation?

By default, the defragmentation tool will only defrag the files which are under 64 MB of size. Fragments of this size already contain at least 17000 contiguous clusters. This means that large files such as games and movies won’t be defragged using the default defragmentation. You will need to pass on a specific command to make sure it does (-w as explained later on).

Before the computer can start defragging your drive, it needs to make a map of the whole disk especially all the empty spaces and the files sizes. It chooses the file from the first free space to move. If the free space is large enough, it directly stores the file there. If not, it finds the file next to the free space and moves it somewhere temporarily. This makes the free space bigger until it is large enough to move the first file there in one contagious piece (contagious means not breaking the file down and storing it as a whole). It carries on doing this until there are no free spaces left on the disk.

There are a few points to remember:

  • Disk Defragmenter will not defrag the files which are already in use.
  • Disk Defragmenter doesn’t defrag the files present in the Recycle Bin. This is understandable as you will be wasting your resources if the file was to be deleted anyway in the end.
  • Disk Defragmenter doesn’t defrag the following files: Safeboot fs, Bootsec DOS, Safeboot CSV, Hiberfil sys, Safeboot RSV, Windows page file and Memory Dump. There are a few parameters we can use to make sure it also defrags the boot files.

How long does Defragmentation take or How many passes does it need?

Defragmentation really depends on the hardware you are using. The larger the hard drive, the longer it will take; the more files stored, the more time computer will require to defrag all of them. The time varies computer to computer as each one has its own unique case.

The time can range from several minutes to several hours to finish. Of course, you can keep using your computer when the process is underway but it is recommended to avoid copying or moving of files as it will only make the process much longer. The time can even go to 24 hours if you have a huge drive which is filled with all sorts of stuff.

Defragmentation also does the tasks in passes. It does a rough pass at first and refines it the next time. After each pass, your hard drive becomes more organized and faster to access.

What the additional commands we can pass to the module?

There are a few command line options for you declare which will make the defragging proccess change as you like. The main command in the command line is “defrag C:”, where “C:” is the drive which you are trying to defrag.

-r This is the default setting of the defragmentation and it only defragments file segments less than 64 MB

-c This command defragments all volumes on your computer. You don’t need to specify a disk letter when using this command.

-w This performs a full defragmentation of files of all sizes on a specified disk no matter the size.

-i This makes the defragmentation only run the computer is idle.

-v This command makes sure that the defragmentation modules displays complete reports for you upon completion.

-b It optimizes boot files only.

-a This command will analyze the selected drive and display a report, consisting of analysis and defragmentation reports.

You can easily pass the command lines using command prompt when launching the disk defragmenter manually. For example, we can execute the “-w” command on local disk C by executing the following command:

defrag C: -w

You can also pass several parameters at once by separating the command with space in between. For example, we can run the “-w” and “-i” by executing the following command:

defrag D: -w –i

Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

What is Defragmentation and how long does it take?

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested