How to Defrag a Windows 11 PC

Boost your computer's performance by defragging storage disks in Windows 11 every once in a while.

How to Defrag a Windows 11 PC

Defragging your secondary storage has been one of the go-to solutions for eliminating performance issues on PCs. Moreover, even Windows (by default) is supposed to automatically defrag your hard disk periodically.

However, many of us might still not have an idea about what exactly causes a hard disk to fragment, and how to check or manually defrag your hard disks. Well, if you have been thinking of this stuff lately, we got everything covered in this article.

What Causes Fragmentation of your Storage?

Fragmentation basically scatters your data all over the storage drive on your machine which happens due to the regular usage of your machine as you install and delete programs or files over time.

To give you more perspective, you can easily find a specific page in the book having page numbers in a linear series; now imagine trying to find a page on a book having jumbled-up page numbers. That is exactly known as fragmentation, as you delete files and program it makes multiple inline blocks of storage go empty, and if a new program or file is not exactly the same size as the empty block; your system stores it on a new block making the storage structure consist multiple gaps.

Now since the majority of computers still use HDDs that have a mechanical arm to read a block of data on a physical rotating disk, fragmented storage requires much more time to access files and folders relative to a defragmented storage since the movement of those mechanical parts cannot exceed a set speed.

Now, as more of these fragments are created when more and more data is written and deleted, the storage drive has to move more to access the files. Since more movement equals more time consumption it eventually makes the PC slow in reading and writing the data.

Defragmentation is the sure-shot solution to it as neatly lines up all the filled memory spots and eliminates the gap to avoid movement as much as possible which in turn provides faster read-write speed on your computer.

Though fragmentation affects the HDDs more than it does SSDs since the former has moving parts, SSDs also do need fragmentation just not as much frequently as there are no moving parts in it.

Well, now that you understand fragmentation and why we need to defragment our drives, let’s move on to actually doing that. Windows offers two ways to defrag your volumes and we are going to take a look at both of them.

Defrag Your Hard Disk Using Drive Optimization

Windows has a built-in tool to defragment your storage device. You can also set a custom routine to let it run automatically out of your active hours.

To do so, first, click on the ‘Settings’ app from the Start Menu of your Windows machine.

Then, click on the ‘System’ tab present on the left sidebar of the ‘Settings’ window.

Next, click on the ‘Storage’ option from the left section of the ‘Settings’ window.

After that, scroll down and click on the ‘Advanced storage settings’ option.

Then, click on the ‘Drive optimization’ tile from the list. This will open a separate ‘Optimize Drive’ window on your screen.

Now on the ‘Optimize drive’ window, you will be able to see the current status of the periodic defragmentation of your storage, their current status of fragmentation, and the last analysis of the drives as well.

Next, if you want to check if your drives need optimization, select your windows installer drive and click on the ‘Analyze’ button present in the ‘Status’ section.

Note: If it has been more than a week since your drives were optimized, skip this step and jump to the next step.

It might take a few minutes to analyze your drive, wait till your system does that.

After the analysis cycle is completed, if the ‘Current Status’ columns display ‘OK’ next to your selected drive, your drive does not need defragmentation as of now. However, if the ‘Scheduled optimization’ is ‘Off’ you must enable it to preserve your system’s performance which is explained in this guide further.

After that, to manually defrag your drives, select your windows installer drive and click on the ‘Optimize’ button present on the window.

Note: While defragging windows installer drive will give you a major increase in performance, it is recommended that you defrag all your drives individually.

Manual defragmentation of drives absolutely does the job, however more ideal would be to let Windows do this job for you automatically and periodically to maintain the performance of your machine.

To schedule defragmentation of your drives, click on the ‘Change settings’ button present under the ‘Scheduled optimization’ section of the window. This will open a separate window on your screen.

After that, click on the checkbox preceding the ‘Run on a schedule’ option present on the window.

Then choose the frequency of the schedule by clicking on the dropdown menu followed by the ‘Frequency’ field. Choosing ‘Weekly’ frequency is recommended.

Then, click on the checkbox preceding the ‘Increase task priority, if three consecutive scheduled runs are missed’ option to make sure if the scheduled runs are missed your computer defrags the drives inside the active hours.

Now, click on the ‘Choose’ button to select the drives you want to defrag on the set schedule. This will open a separate window on your screen.

Then, click on the ‘Select all’ option present on your screen to select all the drives. Then, click on the checkbox preceding the ‘Automatically optimize new drives’ field and finally, click ‘OK’ to confirm and close the window.

Your drives will be automatically and periodically defragmented to maintain the performance of your PC without your intervention.

Defrag Your Hard Disk Using Command Prompt

Windows also provide you with a way to defrag your hard disk using the Command Prompt along with a tad bit more control over the process relative to when initiating through the GUI counterpart.

To do so, right-click on the ‘Start menu’ present on the taskbar of your Windows machine and click to select the ‘Windows Terminal (Admin)’ option from the overlay menu.

Note: It is required that you run the Windows Terminal as an administrator to perform the defrag operation.

Then, click on the carat icon (downwards arrow) present on the tab bar and select the ‘Command prompt’ option from the overlay menu to open Command Prompt. Alternatively, you can also press Ctrl+Shift+2 on your keyboard to open the Command Prompt tab.

After that, to analyze your drive if it needs the defrag or not, type the defrag <drive letter> /A command hit Enter on your keyboard. This will show you volume size, current free space, total fragmented space, and will also display if you need to defrag the specific drive or not.

Next, to defrag the drive after analysis, type defrag <drive letter> and this will simply start the defragmentation of your specified drive on your machine.

Note: Do not close the Command Prompt window before the defragmentation is complete, as that will kill the process.

Now, if you want to defrag all your drives a single go, you can type defrag /C and hit Enter on your keyboard. This works exactly the same as the GUI tool earlier explained.

In case you want to exclude a single drive or even a couple of drives and perform the defrag on all other available drives. type defrag /E <drive letter> to run the operation.

Note: If no drive is mentioned for exclusion, this function will behave similarly to defrag /C.

Moreover, to optimize and increase the boot performance of your Windows machine, type defrag <drive letter>/B and hit Enter on your keyboard.

Note: This operation could take from minutes to hours depending on the drive size and files present in the Windows installer drive.

Now, there can be scenarios where you might forget these commands and that’s alright; you can simply remember to type the defrag /? command, and Windows Terminal will bring up all the options supported by the defrag on your screen.

What Cannot be Defragmented on Windows 11?

As important it is to know how to defrag your volumes, just as important is to know what cannot be defragmented, especially in case you are invoking commands using Command Prompt.

  • If the drive is already in exlusive use by another program.
  • The drive is formatted in FAT or FAT32 file system rather than NTFS.
  • You won’t be able to defrag network drives and optical drives.

Well, defragmentation is all laid out to you here, make sure to have your PC periodically defragmented and educate your friends who are experiencing a slower than usual performance on their Windows machine.