[Answered] How Does Disk Defrag Work?

Learn how does disk defrag work to improve disk performance and show 3 practical methods to defragment your hard drives.

Lucas

By Lucas / Updated on May 12, 2023

Share this: instagram reddit

How does disk defrag work?

What does a disk defrag do? To answer this question, we need to start with some basic content about how HDD works to store data.

1. How does hard drive read and write?

There are many parallel disc platters and a magnetic head on the storage surface of each platter, as shown in the diagram of hard disc construction below. While the platters rotate at a rapid speed, the head actuator regulates the movement of each head. As a result, the head may read and write data to the disk's designated location.

Hard disk construction

There are tracks on the platters. When the system store files on the disk, the data are written on the platters from the inner track to the outer one.

And the system also reads out the data in the same order. It tells the head actuator the position of the file to be read, and the head will move to the position, and wait for the required sector to move under the head.

2. Why disk fragmentation occurs?

Hard disk fragmentation refers to the discontinuous files generated in the process of hard disk reading and writing. Why are they discontinuous? If they’re arranged together, the head can reach all relevant files quickly, and then the speed will be fast. Indeed, in theory, yes.

Well, the fact is that the created files will spread around in different locations as the following picture shows.

Storage ways

From the first question, we knew the visiting path of the file is also the path of writing. Thus, the head will spend more time seeking all relative data, and if one file must be changed, it means that the following data will be placed in other free places on the disk.

If this file is deleted, it will leave spaces in the system. Over time, our file system will become fragmented, this is so-called fragmentation.

3. What does disk defragmentation do?

Defragmentation example

(The scattered data)

If the files are arranged orderly, the head arm only needs to find the track once and read it by the magnetic head.

So, the defragmentation is to rearrange the scattered data on the hard disk in an orderly manner to reduce seeking time and increase the speed of disk access to files.

Example

(The ordered data)

How to defrag in Windows 11/10/8/7?

Since the defragmentation is really a nice daily maintain for hard disk, Windows has its own tools to defragment the hard drive. In this section, we’ll teach you how to defrag in Windows 10 with 2 Windows tools, and recommend you a better defrag software.

To defrag by Windows tools

1. Defrag in Command Prompt

You can use defragment order in CMD to defrag your hard drive.

Step 1. Press “Windows” + “R” at the same time to open the “Run” box, then type “cmd” to open CMD.

Step 2. Insert “defrag x:” (x is the name letter of your external hard drive.) and hit “Enter”.

Wait for the process, you can see the volume information in the window.

Defrag via CMD

2. Defrag with Defragment and Optimize Drives app

“Defragment and Optimize Drives” is a Windows program for Windows 11/10/8 users. It can analyze the fragmentation of your drives and defrag them. Here, we use Windows 10 as an example, but the steps are the same for Windows 8 users.

Step 1. Please type “Defragment” in the search bar. And click the best match “Defragment and Optimize Drives” to open it.

Optimize tool

Step 2. Then the “Optimize Drives” window will appear. In the Status box, you can see all readable drives that are allowed to optimize and defragment.

Optimize drive

Step 3. Select the drive you want to defragment. You can make a choice according to the “Current status” column. 

Defragment Windows 10

Step 4. Click “Optimize” to defragment the selected drive. You need to wait for a while.

Procedure defragment windows 10

Note: For Windows 7 users, after you search “Defrag” in the search bar, please click “Disk Defragmenter”, and then the operations are the same as Windows 10/8 system. However, the process may need a few hours, please don’t interrupt it.

Disk defragmenter Windows 7

To defrag by defrag software

Since there are built-in tools that can be used to defrag, why do you need third-party software?

You see, if you’re a Windows 7 user, the procedure of defragmentation will waste much time, and you can’t ensure what operation you do during this process may interrupt the defragment.

For Windows 10/8 users, if you input the wrong order, your hard disk might be damaged; if you use Defragment and Optimize Drives app, you’d have to defrag those drives one after another. It’s a little labor-consuming.

Thus, professional and time-saving software is a convenient tool to assist you. AOMEI Partition Assistant Standard is such a wonderful choice. The “Defrag Disk” feature of this free tool can analyze one drive while defragmenting another one. The users can read clear information of the drives and then decide whether to defrag or not according to the analysis results.

Download Freeware Win 10/8.1/8/7/XP
Secure Download

Note: If the partitions on your external hard drive are not NTFS partitions, please convert them to NTFS partitions before we start to defragment.

Step 1. Install and launch AOMEI Partition Assistant, right-click on the disk and select the "Disk Defrag" function.

Disk defrag

Step 2. Check the partition needed to be analyzed, and click "Analyze". You need to check the partition, not select it. This function currently only supports NTFS partitions, so it will only list NTFS partitions on SSD, HDD, and USB drives.

Analyze

Tip: You can click "Pause" to halt the process and resume later, or click "Stop" to end the analysis process completely.

Pause

Step 3: The program will score the partition based on the fragmentation rate when the analysis is over.

There are 3 statuses according to the score:

• Normal: Score≥90. The partition is in good condition, with no need for defragmentation.
• Suggest defragmenting: 60≤Score<90. The current partition has some fragments, which suggest running defragmentation.
• Defragment now: Score<60. There are many fragments in the current partition, suggest running the defragmentation immediately.

You can check the distribution of fragments through the Tetris view.

Step 4. After the analysis is finished, you can click on "Details" to see more information about the analysis results:

•Total files and directories
•Fragmented files
•Fragments
•Fragmentation Rate

Details

Step 5. Click the "Defrag" button to start the defragmentation.

Score

Tip: You could click "Pause" to halt the procedure and resume later, or click "Stop" to terminate the process completely.

After the defragmentation is completed, the partition will be scored according to the defragmentation result.

Defrag complete

Note: If the fragment files are in use, they cannot be defragmented.

Further reading: Should I defrag SSD?

Be careful, you cannot defragment your SSD for these reasons:

1. SSD is made of solid-state electronic memory chip arrays, thus the principle of storage in SSD is totally different from HDD. Your computer won’t become slow even if you have a large number of fragmented files

2. Because of the storage properties of SSDs, the number of erasing and writing operations is restricted. Once the limit has been reached, the disc will no longer be able to be written to and will be discarded. Therefore, defragmentation may shorten the lifespan of SSD.

3. Partition Assistant will show the information of SSD as "Normal", even though there are some fragments. If you check the SSD partition, you will see a pop-up message. Please click "No" to exit.

Warning

How does disk defrag work? Now this problem won’t bother you anymore. All 3 methods are available to defrag the hard disk. However, AOMEI Partition Assistant is more pragmatic than the other 2 tools. You can safely and effortlessly defragment your hard disk to improve disk performance. What’s more, this powerful disk and partition guardian can give you maximum rights to manage your disks and drives.

You can update this tool to Pro edition to do schedule defrag and try more functions like “Partition Alignment” to speed up your SSD or if you need, you can even convert MBR to GPT/GPT to MBR without data loss.

Lucas
Lucas · Staff Editor
I prefer peaceful and quiet life during vacation,but sometimes I watch football match if my favorite club performs brilliantly in that season. And I love reading, painting and calligraphy, thus I send my friends festival handwriting cards every year.