pagefile.sys: What you need to know about the paging file in Windows
If storage space in a system is running low, cleaning out unnecessary files becomes a priority. Though useful in most cases, no important system files should be deleted during the clean-up process. Many of these files, which guarantee that the operating system can run smoothly, are hidden for this reason and require special access controls.
In the Windows operating system, one of these files is pagefile.sys, which is used to manage memory. What exactly is hidden inside this file, and why is it generally not a good idea to delete pagefile.sys?
What is pagefile.sys?
Pagefile.sys is the paging file for the Microsoft Windows operating system. The file is created and operated automatically by the system and has the sole function of lightening the load on the working memory when handling programs and processes that take up a lot of processing power. To this end, whenever there isn’t enough space in the available working memory for all data, Windows first expands the addressable system memory. The system can then assign the relevant files into this additional address space and shift them into pagefile.sys.
For applications, it makes no difference whether the files are cached in pagefile.sys or the physical memory. That said, access to the page file is significantly slower for technical reasons, which is why there can be substantial performance loss if large quantities of data are moved to pagefile.sys. Depending on capacity and the system version, the file can vary from a few megabytes to more than a gigabyte. For pagefile.sys in Windows 10 (on most devices), for example, the latter is the standard.
The size of the paging file is generally dynamic as it conforms to the amount of working memory currently required. Many applications also store data in the paging file even if there is actually sufficient free space in the working memory. This tends to happen when a program is minimized, in order to increase the storage quota for all applications and processes that are currently active. A fixed maximum size can be set manually.
Deleting pagefile.sys: is it possible and advisable?
Given the very high demand for hard disk space that the Windows paging file requires (particularly with devices with limited storage capacity such as notebooks), the question arises whether one should delete pagefile.sys. However, that’s not advisable. The paging file is intended to manage storage resources in Windows and its absence could reduce system performance or even cause Windows to crash. The same applies to programs that rely on pagefile.sys as standard even when sufficient working memory is available.
It’s no coincidence that Microsoft classifies the paging file as a “protected system file”, which in Windows 10, for example, can only be seen after carrying out the following steps:
- Use File Explorer to open the drive that you have Windows installed on (normally C:).
- Switch to the tab “View” and tick “Hidden items”.
- Then, click on “Options” and select “Change folder and search options”.
- Open the tab “View” in the new window too and uncheck “Hide protected operating system files (Recommended)”.
- Now confirm the changes in the pop-up dialog with “Yes”, and then click on “Apply” and “OK”.
- Pagefile.sys should now be visible directly in the Explorer.
If you now try to delete pagefile.sys, you will find that it is not possible. Instead, you’ll receive the message that the paging file “is open in another program”, because Windows and other applications actively access the file while they are operating.
As long as you have administrator rights, however, you can still delete the paging file from your system by deactivating the storage management function and then rebooting Windows. Disconnecting and deleting pagefile.sys in Windows 10, for example, works as follows:
- Open the Control Panel via the start menu.
- Select “System” (requires icon view in the control panel) and the option “Advanced system settings” in the left-hand menu.
- Open the tab “Advanced” if it isn’t already open, and click on “Settings” in the section “Performance”.
- Within the Performance settings, go to the tab “Advanced” and click on “Change” under “Virtual memory”.
- Untick “Automatically manage paging file size for all devices” and then check the option “No paging file”.
- Click on the button “Set” and confirm the changes with “OK”. Now restart Windows to remove the current version of pagefile.sys.
Moving pagefile.sys: Chance of boosting performance
If you’re using several hard disks, you don’t necessarily need to delete pagefile.sys when memory space gets tight. You can move the paging file to another data carrier instead. This can be useful if you want to unburden an SSD drive and free up valuable SSD space. Reading and writing permissions for pagefile.sys can then be found on the alternative data carrier, which may slightly improve general performance.
In order to move pagefile.sys, follow these steps:
- Open the advanced system settings (“Control panel” -> “System” -> “Advanced system settings”).
- Open the tab “Advanced”.
- Under “Performance”, select “Settings”.
- Open the tab “Advanced” again and select “Change”.
- Deactivate the option “Automatically manage paging file size for all devices” by unchecking the box.
- Select the data carrier that you would like to move pagefile.sys to, check the item “System managed size”, and confirm the change by clicking “Set”.
- Then select the drive where pagefile.sys was administered up to now and “No paging file”.
- Now restart the computer.
In the working memory settings you can also define an individual minimum and maximum size for pagefile.sys. To do this, simply click on the item “User-defined size” and then enter your desired values (in megabytes). The size of the paging file cannot be less than 16 MB, however. As with moving and deleting pagefile.sys, the option “Automatically manage paging file size for all devices” has to be deactivated.