HDG Explains – Swapfile.sys, Hiberfil.sys and Pagefile.sys in Windows 8

In previous versions of Windows, you probably remember the good ol paging file. It’s used to when physical memory becomes overcommitted and it hold 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, 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 8. What is fast startup? It basically allows Windows 8 to perform a hybrid shutdown. This is why Windows 8 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.

In order to use the new hybrid shutdown feature, which is turned on by default, hibernation has to be enabled in Windows 8. 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 8.

 

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 8 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 8, you’ll see that the paging file is now the same size as the amount of RAM you have.

pagefile sys

In the above screenshot, I have a Windows 8 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 Metro 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 8 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 256 MB in size. As of now, it’s used for Metro 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 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 8, that means you’re going to have a 16 GB hibernation file too! If you’re running Windows 8 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 8 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 something like that, you can save yourself 8 GB 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. If you have any questions, feel free to post a comment. Enjoy!

More posts from the Featured Posts Category

windows old.png

Remove Windows.old Folder in Windows 8

Favicon for Help Desk Geek

Reduce the Size of Tabs in Chrome and Permanently Pin Them

Should You Defrag an SSD?

hyper-v.jpeg

Enable Windows 8 Hyper-V

Popular Posts This Month

runas command

5 Windows Alternatives to the Linux sudo Command

5 Utilities for Changing DNS Servers in Windows Reviewed

windows defender

Windows Defender vs. Security Essentials vs Safety Scanner

youtube ie11 freezing

How To Fix Flash Crashes in Internet Explorer 11

Comments [4]

  1. Constantine says:

    Hello,

    How to disable swapfile.sys? I do not use Metro apps.

    Kind regards,
    Konstantin

  2. Me says:

    How do I delete swapfile.sys?

  3. Anonymous Techie says:

    To the other two posters:

    You can’t. End of story. It’s only 256MB, anyway, which is nothing on modern hard drives.

    Typical Microsoft BS.

  4. me 2 says:

    The only way to remove the swapfile.sys is to disable the paging file. Set it to ‘No Paging File’, then the swapfile.sys will go away..

Leave a Reply