DEV Community

Cover image for How many passes does disk defragmenter do
CoderLegion
CoderLegion

Posted on • Originally published at kodblems.com

How many passes does disk defragmenter do

Defragmenting the disk is removing all random free spaces, then collecting all the files and storing them in contiguous blocks of memory. It makes the recovery of files much faster.

A hard drive consists of a head from which it reads data. The operating system has a map of all files and is saved. Direct your head to a specific location and access the data stored there. The head should traverse the disk to that location and read the data.

Now imagine if your computer's disk had files saved with many spaces in between. The main head would have to change its location repeatedly to read a file. It will effectively increase the access time to the file. Disk defragmentation attempts to eliminate this extra time.

How many passes does it take to Defragment?
Defragmentation depends on the hardware being used. If the drive is larger, the longer it will take; If their are more files stored, the longer it will be for the computer to defragment all of them. The time varies from one computer to another since each has its box.

The time can be from several minutes to several hours to finish. Of course, you can continue to use your computer when the process is running, but it is recommended to avoid copying or to move files as it will only make the process much longer. The time can even be as long as 24 hours if you have a substantial hard drive full of all sorts of things.

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

What are the additional commands that we can pass to the module?
There are a few command-line options for you to declare that will make the defrag process change to your liking. The central command on the command line is "defrag C:", where "C:" is the drive you are trying to defragment.

(r)This is the default defragmentation setting and only defragments file segments smaller than 64MB
(c) The command defragments all volumes on the computer. You do not need to specify a drive letter when using this command.
(w) Performs a full defragmentation of files of all sizes on a specified disk, regardless of their size.
(I) In this way, defragmentation is only carried out when the computer is idle.
(v) This command ensures that the defragmentation modules display full reports at the end.
(b) Optimize startup files only.
(a) This command will analyze the selected drive and display a report including the scan and all defragmentation reports.

Anyone can easily pass the command lines by using the command line when you launch the disk defragmenter manually.

Hope this post helped you, like, comment and share! :)

Top comments (0)