How to Defragment Hiberfil

By Jason Artman

In Windows, "hibernation" is a low-power state in which the contents of the computer's memory are saved to the hard drive and the computer is shut off completely. When the computer is turned back on, the hibernation file is loaded back into memory and the computer returns to the state it was in before it turned off. The hibernation file remains on the computer and, because it is extremely large, it can become fragmented, extending the amount of time it takes to resume from hibernation. Defragment the hibernation file--Hiberfil.sys--to minimize the amount of time required to resume from hibernation.

Things You'll Need

  • Windows XP, Vista or 7

Step 1

Press the Windows logo and "R" keys simultaneously to display the "Run" dialog box. Type "cmd" in the box and press "Enter." The command prompt is displayed.

Step 2

Type "powercfg /hibernate off" and press "Enter." No confirmation is displayed by Windows for this command. This causes Windows to temporarily disable hibernation, which deletes Hiberfil.sys. Minimize the command prompt.

Step 3

Click the "Start" button, then click "Computer" in Windows 7 and Vista or "My Computer" in Windows XP.

Step 4

Right-click your hard drive, then click "Properties."

Step 5

Click the "Tools" tab, then click "Defragment Now."

Step 6

Click the "Defragment" button. Windows defragments the hard drive, moving all of the free space on the drive together so that when the hibernation file is recreated, it will no longer be fragmented.

Step 7

Close the Disk Defragmenter when the process is complete.

Step 8

Bring the command prompt window back up and type "powercfg /hibernate on." Press "Enter." Close the command prompt. The next time the computer goes into hibernation, the hibernation file will be recreated without fragmentation.

Tips & Warnings

  • This general method can be used to defragment the hibernation file in Windows 2000. However, Windows 2000 does not have the "powercfg" command. To disable and enable hibernation in Windows 2000, click the "Start" button, then browse to "Settings" and "Control Panel." Double-click "Power Options," then click the "Hibernate" tab in the window that appears.
  • If you receive an error message in Windows 7 or Vista stating that you do not have permission to enable or disable the hibernation feature, close the command prompt. Click the "Start" button, then type "command" in the search box at the bottom of the Start menu. Right-click "Command Prompt" on the list of search results and click "Run as Administrator."