Locked files defragmentation

Last updated on Jun 3, 2022

Sometimes Windows and applications lock files preventing their defragmentation. While some of the locked files do not affect system performance much, most of them are essential system files and their fragmentation makes your system much less responsive.

Well known examples of essential system files which are usually locked are the page file (pagefile.sys), the swap file (swapfile.sys) and the hibernation file (hiberfil.sys).

Using the latest version of UltraDefrag you can easily defragment locked files at a system reboot, before Windows and applications fully load and lock them. Some of the locked files cannot be defragmented even during a system reboot, but most of them can, including aforementioned page, swap and hibernation files.

Notes

  • Non-system disks encrypted by BitLocker cannot be defragmented at boot time because there is no way to unlock them on early stages of Windows boot. We do recommend to turn off the disk encryption temporarily before the boot time defragmentation and turn it back on afterwards.
  • The boot time defragmentation cannot be performed in Windows safe mode, because the boot time interface of UltraDefrag cannot display text on the screen in this mode, due to a well known system limitation.
  • The boot time defragmentation is not available in the portable edition of UltraDefrag.

Tip

If the disks are heavily fragmented or have never been optimized before it’s a good idea to perform a boot time optimization of the disks instead of the boot time defragmentation. The locked files will be defragmented during the process and additionally the disks will be fully optimized for the best performance possible.

Follow this step by step guide to learn how to perform the boot time defragmentation.

  1. Select the disks you want to defragment the locked files on.

  2. Click Action > Boot time defragmentation > Defragment selected drives.

  3. Click Reboot now to proceed with defragmentation immediately or Reboot later to perform defragmentation at the next system reboot.

  4. During the system reboot UltraDefrag will launch its boot time interface and perform defragmentation of the selected disks.

    UltraDefrag 10.0.0 boot time interface.
    Copyright (c) 2018-2022 Green Gate Systems, LLC.

    UltraDefrag comes with ABSOLUTELY NO WARRANTY.

    If something is wrong, hit F8 on startup
    and select 'Last Known Good Configuration'
    or execute 'CHKDSK {Drive:} /R /F'.

    Keyboard device found: \Device\KeyboardClass0.

    Wait for keyboard initialization (hit Esc to skip) .......... [Done]

    Keyboard device found: \Device\KeyboardClass0.

    Press any key to exit .....

    Preparing to defragment C: ...
    Use Pause/Break key to abort the process early.

    Defragmentation: 100.00%, fragmented/total=0/1009398

    Drive information:

      Total space                 = 118.12 GB
      Free space                  = 15.77 GB

      Total number of files       = 1009398
      Number of fragmented files  = 0
      Fragments per file          = 1.00
      Fragmentation               = 0.00%

    Good bye...

  5. When Windows fully boots launch the graphical interface of UltraDefrag and check whether some locked files are still fragmented or not. If some of them are, it means that either Windows locks them very early at boot and they cannot be processed, or they are just too big to be fully defragmented. In the latter case try to clean up your disk and perform defragmentation once again.

Share this page:
Scroll to Top English