102

I am running out of space on my %SYSTEMDRIVE% on Windows. There is hiberfil.sys file that size of it is almost 3GB.

I understand that hiberfil.sys is used for the windows hibernation feature. https://support.microsoft.com/en-us/help/13770/windows-shut-down-sleep-hibernate-your-pc

The Hiberfil.sys hidden system file is located in the root folder of the drive where the operating system is installed. The Windows Kernel Power Manager reserves this file when you install Windows. The size of this file is approximately equal to how much random access memory (RAM) is installed on the computer.

The computer uses the Hiberfil.sys file to store a copy of the system memory on the hard disk when the hybrid sleep setting is turned on. If this file is not present, the computer cannot hibernate.

I don't want to disable the hibernatation feature.

Is there any way to move hiberfil.sys to another drive other than %SYSTEMDRIVE%?

BozoJoe
  • 205
  • 2
  • 6
Hamed
  • 5,750
  • 10
  • 31
  • 39
  • 2
    No you cannot, there is simply no way. – HackToHell Mar 20 '12 at 11:41
  • 27
    Obligatory Raymond Chen: [Windows Confidential: The File System Paradox](http://technet.microsoft.com/en-us/magazine/2007.11.windowsconfidential.aspx) – u1686_grawity Mar 20 '12 at 12:12
  • 1
    This has to be a dupe. . . – surfasb Mar 20 '12 at 13:34
  • 3
    The "external-drive" tag is also worrying. Computers don't like it when their memory can walk off. – MSalters Mar 20 '12 at 13:39
  • How about a symbolic link? – Ahmed Oct 08 '15 at 01:29
  • 6
    Possible duplicate of [How to change location of hibernation file in Windows 7?](http://superuser.com/questions/85369/how-to-change-location-of-hibernation-file-in-windows-7) – PJTraill Sep 02 '16 at 13:05
  • 2
    I noticed that hibernation has an entry in BCD, when I was using `bcdedit.exe /enum all` –  Jan 16 '17 at 11:50
  • 1
    I wonder if it's possible to simply MKLINK (aka Symbolic[ally] Link) it. – Mark C Dec 27 '21 at 00:04
  • 1
    So with BCD you can, but NSOSkrnl.exe needs to be patched (sym-link was not accepted). http://superuser.com/a/1082931/31491 – Mark C Dec 27 '21 at 09:07
  • @MarkC I wondered exactly the same (albeit several years later)... If you look at the `Raymond Chen` link above, that explains why it's sadly not an option :/. – JohnLBevan Mar 24 '23 at 12:53
  • 1
    @JohnLBevan He doesn't get to the bottom of it. You can, but the drive number(?) it tries to load from is simply a defined constant and so you need to patch NTOSkrnl.exe (which has been done by another, on a slightly different Win7 build number). – Mark C Mar 25 '23 at 00:30

6 Answers6

33

I don't think it is possible to "redirect" the path of your hiberfil.sys from "C:\hiberfil.sys" to "D:\hiberfil.sys" for example.

I did some research on Google and in the Windows registry, and found nothing but the option to disable it (and consequently delete hiberfil.sys file):

  1. Click Start, and then type cmd in the Start Search box.
  2. In the search results list, right-click Command Prompt, and then click Run as Administrator.
  3. When you are prompted by User Account Control, click Continue.
  4. At the command prompt, type powercfg.exe /hibernate off, and then press ENTER.
  5. Type exit and then press ENTER to close the Command Prompt window.
Run5k
  • 15,723
  • 24
  • 49
  • 63
Diogo
  • 30,192
  • 65
  • 150
  • 222
30

Instead of disabling hibernation, you can reduce the size of the hibernation file to a maximum of 50% of the total physical memory:

  1. Click Start, and then type cmd in the Start Search box.
  2. In the search results list, right-click Command Prompt, and then click Run as Administrator.
  3. When you are prompted by User Account Control, click Continue.
  4. At the command prompt, type powercfg.exe /hibernate /size 50, and then press ENTER.
  5. Type exit and then press ENTER to close the Command Prompt window.

The size of hiberfil.sys will be reduced immediately.

Update: Be aware that if your system RAM cannot be compressed to 50% of its size when you hibernate, you may get a blue screen with INTERNAL_POWER_ERROR similar to this one, which might be difficult to diagnose:

BSOD "INTERNAL_POWER_ERROR" in Windows 7 on hibernation

mhu
  • 431
  • 6
  • 11
  • Diogo posted exactly the same solution before, and with attribution. -1 – Joris Groosman Nov 03 '15 at 14:55
  • 10
    @JorisGroosman This not the same solution. Please note the difference in step 4. The OP didn't want to disable hibernation as Diogo's solution does. The solution above cuts the size used by the hibernation in half. – mhu Nov 05 '15 at 19:52
  • Yes just to confirm, I'm someone who came to this post with a similar question - it worked here. It reduced the size of my hibernation file from over 6 to just over 4 gigabytes. It wouldn't let me reduce to less than 50% of RAM so that may be as low as it gets - I tried 25% but the file stayed the same size as for 50%. I have 8 gigs of installed RAM – Robert Walker Jul 17 '17 at 01:16
  • Without the ability to physically move it, this actually is the best solution to the problem, without disabling it. This solution would be great for a system with lots of ram, but small amounts of storage. (Which in my current case, is exactly how my windows installation is. – x4g0tt3nSou1x Jun 26 '21 at 07:16
19

Unlike SLEEP mode, where everything that is running on your system is stored in your RAM, (which is kept powered), HIBERNATION copies the entire state of your RAM to a file called HIBERFIL.sys. That is why that file has to be at least as big as the size of your RAM. Your computer turns off altogether, as it doesn't have to have any of your components under constant power.

BUT, next time you want to get your machine woken up from Hibernation state, to find it at the same point where you left it, it needs that boot-up sector of your System disk...

Unfortunately there's no way to move that HIBERFIL.sys around to your other HDDs or partitions.

This is unlike PAGEFILE.sys, which you CAN relocate to some other physical disk or partition, so your system disk doesn't have to handle the Pagefile.

Gras Double
  • 1,068
  • 12
  • 20
Tutan C'mon
  • 215
  • 2
  • 2
  • 3
    This article helped me decide I don't want hibernation and to save the to be able to remove the 32Gb file from my SSD. http://www.verdiem.com/blog/2011-11-15/put-them-sleep-dont-hibernate – Valamas Nov 13 '13 at 10:29
  • 1
    @Valamas Verdiem has been since bought by another company and the site has been disabled. Here's an archived version of that link: https://web.archive.org/web/20150317121812/http://verdiem.com/blog/2011-11-15/put-them-sleep-dont-hibernate The information listed there is basically that Sleep doesn't use much more energy than Hibernatio, but boots up faster. – sp00n Jul 07 '16 at 17:35
  • But on my PC, my USB ports don't wake up properly from sleep, but they do wake up properly from hibernate, so even on a desktop it may be a good thing to turn on for some people. Wish it didn't take almost 6GB of space though. – PRMan Jan 15 '22 at 20:32
  • @PRMan See here for space saving (use any %) https://superuser.com/a/851818/31491 – Mark C Mar 25 '23 at 00:34
10

You can only disable it, not move it because, when present, hiberfil.sys is needed much earlier in the OS boot sequence.

At that point in the boot sequence, the OS is not able to understand symbolic links,

So the only place it will look for hiberfil.sys is on the OS root drive. More on Relocate hiberfil.sys

Dark Knight
  • 207
  • 2
  • 5
0

It should be on the same disk as booloader (NTLDR/BOOTMGR) so bootloader can pick it up early and copy to RAM.

Try moving the bootloader.

Mikhail Kupchik
  • 2,501
  • 15
  • 22
  • After moving bootloader, How could I redirect the path of `hiberfil.sys` ? – Hamed Mar 20 '12 at 19:32
  • It will be on the same partition as bootloader, in the root folder. – Mikhail Kupchik Mar 29 '12 at 11:47
  • 5
    My bootloader is in other drive, I was suspected. I think it don't related to bootloader. It related the Windows partition. – Hamed Mar 30 '12 at 14:49
  • 1
    This is actually the closest to an answer I think, you can't tell windows to look some where else. But it depends does windows look at the root of where it's installed, or the root of the boot drive?? (these by default are the same, but by no means have to be). If its the latter then this answer will work (if fiddly to achieve). – cjb110 Feb 08 '13 at 10:43
  • rereading the Raymond Chen post, it does say boot drive, not Windows install drive... – cjb110 Feb 08 '13 at 10:45
  • 10
    False answer. In Windows Vista and later, the bootloader is located on a hidden partition while `hiberfil.sys` is located in C: –  Jan 16 '17 at 11:48
  • @user477799 I am looking at a Vista install and the hibernate FILE is on %SYSTEMDRIVE% (C:). – Scott R Mar 26 '20 at 08:30
-3

Despite being late to the party, I am researching the same topic.

According to isunshare website you are supposed to:

  1. temporarily disable hibernation (powercfg -h off),
  2. move the hibernation file to the appropriate path,
  3. then navigate the registry editor to open HKEY_LOCAL_MACHINE > SYSTEM > ControlSet001 > Control > BackupRestore > FilesNotToBackup > PowerManagement and change the value from \hiberfil.sys to its new path, e.g. d:\hiberfil.sys.
  4. Re-enable hibernation with powercfg /hibernate on (and maybe powercfg /h /size 100, to avoid unexpected INTERNAL_POWER_ERROR bsod).

I have yet to test this and will update the answer once I am done with it.

beppe9000
  • 631
  • 9
  • 21
  • 1
    This really does not work in up-to-date Win10 Pro instances, because drive mounting occurs in later stages of the boot-process, especially with fast-boot enabled. What does work is some reduction, as stated earlier here as well. For me, as an example, with 64GB DDR I could reduce the size to 63% as a minimum, when I tried 62 or smaller it would not hibernate properly, so I did `powercfg hibernate size 65` to be sure. If power-usage of keeping RAM online isn't too high, I'd pick sleep-mode over hibernation. Wake up time from sleep is faster than from hibernation as well. – Julius Oct 19 '21 at 11:37
  • 1
    Don't do this! It first disables hibernation. Then moves a file that is no longer used, and configures backup to not backup the new location of the now useless file. There is no step to re-enable hibernation, and if it would one, it would create the original file in C: drive again. – Gerardo Grignoli Sep 05 '22 at 22:15