In previous versions of Windows, you probably remember the good old paging file. It is used when physical memory becomes over-committed and it holds objects that usually have not been accessed in a long time. That is pagefile.sys. Next, we had the hibernate option in Windows that let you save the kernel and all applications to your hard drive so that you could start your computer back up faster than doing a full reboot. That is hiberfile.sys.

In Windows 8/10, things get more complicated. The pagefile.sys is there all the time, but the hiberfil.sys is only there if you have fast startup enabled in Windows. What is fast startup? It basically allows Windows to perform a hybrid shutdown. This is why Windows 8/10 boots up so much faster than previous versions of Windows. Check out my previous post that explains what a hybrid shutdown is in Windows 8.

Table of Contents

    In order to use the new hybrid shutdown feature, which is turned on by default, hibernation has to be enabled in Windows. If hibernation is disabled, you won’t have a hiberfil.sys file and you won’t be able to use the fast startup option either. You can read my post here about enabling hibernation in Windows.

    Windows 8 swapfile

    Now the interesting thing is that when you have fast startup enabled (meaning hibernation is enabled), then your hiberfil.sys will be about 75% of your RAM and the paging file will be around 25%. This is because the hiberfil.sys contains the Windows kernel and device drivers. The paging file is only used if all RAM is exhausted only our system and is used while you’re actually running Windows. The hiberfil.sys is only used for the boot process.

    If you don’t have hibernation enabled in Windows, you’ll see that the paging file is now the same size as the amount of RAM you have.

    In the above screenshot, I have a Windows machine with 1 GB of RAM and fast startup disabled. Now that we understand how that works, let’s get down to the new one: swapfile.sys. What the heck is that? Well, it’s basically like the paging file, but serves different purposes.

    One of the main reasons for the swapfile.sys is to suspend and resume Windows Store apps. So why not just use the paging file instead to do that? It’s used because certain types of paging operations can be done more efficiently using this special type of pagefile.

    Here’s a more clear explanation. Windows supports both paging and swapping. Paging will hold items that haven’t been accessed in a long time whereas swapping holds items that were recently taken out of memory. The items in pagingfile may not be accessed again for a long time whereas the items in swapfile might be accessed much sooner.

    Also, paging is very effective on high-end machines whereas swapping is more effective on low-end tablets and PCs. Each paging file has different requirements for dynamic growth, space reservation, read/write policies, etc. If you were to have the same paging file, it would become fragmented very quickly because of the fixed-size pages used in paging and the big chunks used in swapping.

    As you can see from above, the swapfile.sys is about 16 MB in size. As of now, it’s used for Store apps because of their different paging needs as compared to traditional Windows programs. There may be other uses too for it in the future, but Microsoft has not specified what exactly.

    So that’s what those three files do on a Windows 8/10 system. Note that there are some interesting and annoying things that can happen. If you have 16 GB of RAM and are using fast startup in Windows, that means you’re going to have a 16 GB hibernation file too! If you’re running Windows on an SSD, that may be taking up a large portion of your disk space.

    You can reduce the size of the hibernation file (hiberfil.sys) in Windows  without disabling hibernation by using the following command:

    powercfg.exe /hibernate /size 50

    powercfg

    This will reduce the size of the hibernation file to 50% of RAM rather than 100%. Note that you cannot lower it any more than 50%. However, if you have a large amount of RAM like 16GB or 32GB or more, you can save yourself quite a bit of space.

    The other thing is that you don’t need to worry about the hibernation file becoming too large like in previous versions of Windows. Earlier the hibernation file stored the kernel, device drivers and all application data. Now that there is no application data, the size of the file stays pretty constant, so if you have a lot of RAM, you probably don’t need a hibernation file that is so large anyway.

    Hopefully, that gives you a clearer understanding of how the pagefile.sys, hiberfil.sys and swapfile.sys files work on Windows 8/10. If you have any questions, feel free to post a comment. Enjoy!

    Leave a Reply

    Your email address will not be published. Required fields are marked *