In previous versions of Windows, you probably remember the good old swap file. It is used when physical memory becomes overloaded and stores objects that would not normally be accessed for a long time. This is pagefile.sys. We then had a hibernation option in Windows that allowed the kernel and all applications to be saved to the hard drive so you could run a PC backup faster than a hard reboot. This is hiberfile.sys.
Things get more complicated in Windows 8/10. Pagefile.sys is present all the time, but hiberfil.sys is only present if fast startup is enabled in Windows. What is Fast Startup? This essentially allows Windows to do hybrid shutdowns. This is why Windows 8/10 boots much faster than previous versions of Windows. Check out my previous post which explains what hybrid shutdown is in Windows 8.
To use the new hybrid shutdown feature, which is enabled by default, hibernation must be enabled in Windows. If hibernation is disabled, you will not have the hiberfil.sys file, and you will not be able to use the fast startup option. You can read my post on enabling Windows hibernation.
Now the interesting thing is that when you have fast startup enabled (i.e. hibernation enabled), your hiberfil.sys will make up about 75% of your RAM, and the paging file will be about 25%. This is because the hiberfil.sys file contains the Windows kernel and device drivers. The paging file is only used if all RAM is depleted only by our system and is used when you are actually working with Windows. Hiberfil.sys is used only for the boot process.
If Windows is not hibernated, you will see that the paging file is now the same size as the RAM you have.
– /
In the above screenshot, I have a Windows machine with 1GB of RAM and Fast Startup disabled. Now that we understand how it works, let’s move on to a new one: swapfile.sys. What the heck is that? Basically, it looks like a swap file, but serves different purposes.
One of the main reasons for using swapfile.sys is to suspend and resume Windows Store apps. So why not just use a swap file for this? It is used because certain types of paging operations can be performed more efficiently by using this special type of paging file.
Here’s a clearer explanation. Windows supports both swap and swap. Paging will contain items that have not been accessed for a long time, while the exchange will contain items that were recently removed from memory. Items in the paging file may not be accessed again for a long time, whereas items in the paging file can be accessed much earlier.
Also, paging is very efficient on high end computers, while paging is more efficient on low end tablets and PCs. Each paging file has different requirements for dynamic growth, space reservations, read / write policies, and more.If you had the same paging file, it would fragment very quickly due to the fixed size pages used in the paging. and large fragments is used when swapping.
As you can see from the above, swapfile.sys is about 16MB in size. It is currently used for Store apps due to the fact that they require pagination different from traditional Windows programs. Other use-cases may find it in the future, but Microsoft hasn’t clarified what exactly.
This is what these three files do on Windows 8/10. Note that some interesting and unpleasant things can happen. If you have 16GB of RAM and are using Fast Startup on Windows, that means you will have a 16GB hibernation file too! If you are using Windows on an SSD, it can take up most of your disk space.
You can reduce the size of the hibernate file (hiberfil.sys) on Windows without disabling hibernation using the following command:
powercfg.exe / hibernate / size 50
This will reduce the hibernation file size to 50% RAM, not 100%. Please note that you cannot reduce it by more than 50%. However, if you have a lot of RAM, such as 16GB, 32GB or more, you can save quite a lot of space.
Another thing is that you don’t need to worry about the hibernation file becoming too large as in previous versions of Windows. Previously, the hibernation file stored the kernel, device drivers, and all application data. Now that there is no application data, the file size remains fairly constant, so if you have a lot of RAM, you probably won’t need a hibernation file that is that large anyway.
Hopefully this will give 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, do not hesitate to leave comments. Enjoy!
–