DEV Community

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

Posted on β€’ Edited on β€’ Originally published at kodblems.com

2 1

How many passes does disk defragmenter do

πŸŽ‰ Before you dive into this article...

πŸš€ Check out our vibrant new community at CoderLegion.com!

πŸ’‘ Share your knowledge, connect with like-minded developers, and grow together.

πŸ‘‰ Click here to join now!

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! :)

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly β€” using the tools and languages you already love!

Learn More

Top comments (0)

Jetbrains image

Is Your CI/CD Server a Prime Target for Attack?

57% of organizations have suffered from a security incident related to DevOps toolchain exposures. It makes senseβ€”CI/CD servers have access to source code, a highly valuable asset. Is yours secure? Check out nine practical tips to protect your CI/CD.

Learn more

πŸ‘‹ Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay