5

My PC shows that the system reserved and the windows partitions are fragmented above 10%. I kept the defrag option running within Windows but there is no impact on the fragmentation percentage.

I was wondering if I can run defragmentation when system boots up, so the files are not locked. But I cannot find any way to schedule a defragmentation on boot.

Is there a way to do it, the way Check Disk utility runs at boot in its own UI?

Edit:

In the screenshot, the system partition and windows partition are both fragmented. Funny thing is, after every click of "Analyze button", it displays different values. I have tried to use command prompt during boot, but that didn't allow the defrag command. I will try to take a picture of that and post it here.

Partition in question

Screenshot of the smart defrag tool Smart Defrag

4 Answers4

3

You could do this manually at boot time via command prompt.

Running Defrag in Command Prompt at boot

  • Open a command prompt at boot.

  • In the command prompt, type diskpart, and press Enter.

  • In the command prompt , type list volume, and press Enter.

Important: Make note of the drive letter that you want to optimize. The drive letter for the drive will not always be the same at boot as it is in Windows.

  • In the command prompt, type exit , press Enter, and go to the step below:

To use the defrag tool, just enter defrag followed by the parameters you want to use. You can view the command’s help file by entering defrag /? .

Then to use defrag, just enter the following:

defrag [name of your drive] [parameter] [extra parameters]

Here are some commonly used defrag commands:

defrag C: / O

Note: Substitute C : in the command with the drive letter you want instead .

i.e

defrag /C /O

In this case the O parameter stands for Perform the proper optimization for each media type (You can customize the parameters to your liking).

References

1

I was wondering if I can run defragmentation when system boots up?

You can use IObit Smart Defrag for this. It has an option to perform a "Boot Time Defrag":

IObit Smart Defrag is another free tool that is worth keeping on the disk drive. (Get the portable version.) This not only defragments files, but it also has a Boot Time Defrag.

enter image description here

This runs a defragmenter utility just after the PC is switched on and before Windows loads. Turn on all the tick box options and click Configure.

IObit Smart Defrag

Select the Only next boot option, click Apply and then OK. Reboot the computer to defrag the system files that are in use.

Source Defragment the disk after upgrading to Windows 10 for speed

DavidPostill
  • 162,382
1

For UEFI/GPT based boot you can mount the system reserved partition first with mountvol b: /s, now you can use defrag b: /U /V to defragment the drive. Now unmount the system partition again with mountvol b: /d.

0

The @xavier_fakerat answer is correct excepting that defrag is not included in my 21H1 windows 10 iso so it will print that defrag is not recognized as an internal command.

Then:

C:
cd Windows\system32
.\Defrag.exe C: /D

Or another defrag option from .\Defrag.exe /? .

Sam
  • 3