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 Answers 4

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

5
  • 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. Jun 25, 2017 at 6:09
  • Sorry but it does not display the system reserved space. I will edit the question with the screenshots to help. Jun 25, 2017 at 6:13
  • 1
    Try giving the system reserved partition a drive letter, using Disk Management
    – DavidPostill
    Jun 25, 2017 at 8:17
  • 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. Jun 25, 2017 at 8:29
  • Defraggler is a nice one also....thewindowsclub.com/…
    – Moab
    Feb 22, 2019 at 22:13
4

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

4
  • It works for Windows Drive. But it is not listing the system reserved drive. Jun 24, 2017 at 12:54
  • 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. Jun 24, 2017 at 13:03
  • 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. Jun 25, 2017 at 6:08
  • 2
    @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.
    – ᄂ ᄀ
    Feb 20, 2019 at 20:11
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.

4
  • it throws an error saying "parameter is incorrect". Jun 25, 2017 at 6:57
  • 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 Jun 25, 2017 at 8:03
  • ok, I forgot this is for UEFI/GPT only. Looks like you use BIOS/MBR Jun 25, 2017 at 18:29
  • 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. Jun 26, 2017 at 4:23
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 /? .

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .