Running Windows disk defragmentation on boot in Windows 10

4

2

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

jitendragarg

Posted 2017-06-24T10:59:57.227

Reputation: 344

Answers

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

Posted 2017-06-24T10:59:57.227

Reputation: 118 938

Thanks man. I will try to use it. Hopefully it works. Will comment here once it is completed. BTW, setup of that software tries to install toolbars too. – jitendragarg – 2017-06-25T06:09:42.053

Sorry but it does not display the system reserved space. I will edit the question with the screenshots to help. – jitendragarg – 2017-06-25T06:13:19.420

1Try giving the system reserved partition a drive letter, using Disk Management – DavidPostill – 2017-06-25T08:17:45.760

Thanks. That worked. Somehow mounting partition was not working from command prompt. But assigning the letter from disk management worked. Now, that tool displays disk partition and is defragmenting it successfully. – jitendragarg – 2017-06-25T08:29:09.373

Defraggler is a nice one also....https://www.thewindowsclub.com/defrag-disk-files-and-system-files-at-boot-time-with-defraggler-v-2-0

– Moab – 2019-02-22T22:13:34.997

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

xavier_fakerat

Posted 2017-06-24T10:59:57.227

Reputation: 2 191

It works for Windows Drive. But it is not listing the system reserved drive. – jitendragarg – 2017-06-24T12:54:46.950

Is your reserved drive hidden? probably could be the reason, also most system reserved or push button recovery partitions are usually hidden and not assigned letter it could be one reason or you have to go to GUI and explicitly include such drives for defragging. – xavier_fakerat – 2017-06-24T13:03:21.023

Ok, I tried to see if the partition was hidden. It was definitely not. It is displayed in disk management. But when I tried to run it, it threw an error right away saying "defrag command does not exist". I tried running it while inside diskpart and from the command prompt directly. Same error both times. Got the Windows partition to work though, so that is good. – jitendragarg – 2017-06-25T06:08:47.443

@jitendragarg defrag.exe is not included in Windows Recovery Environment which is used for command prompt launched via Advanced Startup Options. But you can use the one from the Windows installation, i.e. c:\Windows\System32\defrag.exe. – UnclickableCharacter – 2019-02-20T20:11:01.217

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.

magicandre1981

Posted 2017-06-24T10:59:57.227

Reputation: 86 560

it throws an error saying "parameter is incorrect". – jitendragarg – 2017-06-25T06:57:17.877

I tried mounting the partition using another method, but after mounting, I still don't see the drive listed in any defrag tool, It still lists "system reserved" in window defrag tool – jitendragarg – 2017-06-25T08:03:06.153

ok, I forgot this is for UEFI/GPT only. Looks like you use BIOS/MBR – magicandre1981 – 2017-06-25T18:29:29.590

It's fine. Maybe it will be useful for someone else in the future. For me, just assigning letters directly from disk manager worked. Maybe you can add this info in your answer for other people. – jitendragarg – 2017-06-26T04:23:40.030