Page File (pagefile.sys) is a protected system file located at C:\pagefile.sys on a Windows computer and the overall purpose of this file is to store data offloaded by the computer’s Random-Access-memory (RAM) to hard disk (virtual memory) and make it available for use; whenever it is required by the system.
For example, when Apps are minimized on the desktop; they automatically move their data to the computer’s Random Access Memory (RAM); which allows them to remain active in the background and become available for immediate use. Now, if the RAM requirement on the computer goes up, Windows moves the data of minimized apps from RAM to pagefile.sys; which allows it to meet the growing RAM requirements on the computer.
Is it Safe to Disable, Delete & Resize Pagefile.sys?
Being a system file; Pagefile.sys file remains hidden by default on a Windows computer and it is usually discovered when the option to Show Hidden System Files is enabled on the computer and users are trying to identify large files; that are taking up storage space on the computer.
While it can be tempting to recover several gigabytes of storage space by deleting pagefile.sys file from the computer, the general advice on this topic is not to delete this file. Windows relies on pagefile.sys for its virtual memory requirements and for saving crash dump logs during system crashes. This ensures that the crash dump is preserved and can be used for troubleshooting and analysis; after the system restarts.
If you feel that pagefile.sys is taking up a large amount of storage space on the computer, you can prevent Windows from automatically managing the paging file size on your computer and allocate a reasonable amount of storage space for this file (instead of disabling or deleting this file).
1. Check the Size of Pagefile.sys File
If the option to Show Hidden System Files is enabled on your device, you can check the amount of storage space taken up by pagefile.sys file on the computer by using File Explorer.
1. Open the File Explorer on your computer.
2. On the File Explorer screen, click on This PC in the left-pane and double-click on your Local Drive (C:) in the right pane.

3. After this, scroll down in the right-pane and you will be able to see the amount of storage space occupied by pagefile.sys file on your computer.

2. How to Resize Pagefile.sys File
While the default setting in Windows is to automatically manage the size of pagefile.sys; it provides the option to decrease or increase the size of pagefile.sys file to suit user requirements.
1. Open Run Command (press Windows + R keys).
2. Type SystemPropertiesAdvanced and click on OK.

3. On System Properties screen, make sure you are on Advanced tab and click on the Settings button, located under “Performance” section.

4. On the next screen, go to Advanced tab and click on the Change button, located under “Virtual memory” section.

5. On “Virtual Memory” screen, de-select Automatically manage paging file size option, select your Hard Drive, select Custom size option, type Initial Size and Maximum Size values and click on the Set button.

Note: Set Initial Size to 1.5 times RAM and Maximum Size to 3 times the available RAM on your computer.
6. Make sure you click on OK and Restart the computer to apply this change.
3. Disable or Delete Pagefile.sys
In theory, you should be able to delete pagefile.sys file from computers that are equipped with a high amount of RAM (32 Gb or more) capacity. However, this will still lead to Windows not being able to store crash dumps during system crashes; which is not desirable.
However, if you still go ahead and try to delete pagefile.sys, you will run into “The action can’t be completed because the file is open in another program” error message, which makes it impossible to delete this file. Hence, the first step is to disable pagefile.sys, which prevents the computer from using the file; after which you will be able to delete the file.
1. Right-click on Start button and click on Run.
2. In the Run Command window, type SystemPropertiesAdvanced and click on OK.

3. On System Properties screen, switch to Advanced tab and click on Settings button, located under “Performance” section.

4. On Performance Options screen, switch to Advanced tab and click on the Change button, located under Virtual Memory section.

5. On Virtual Memory screen, uncheck Automatically manage option, select your Hard Drive, select No Paging File option and click on the Set button.

6. On the pop-up, click on OK to restart the computer.
After the computer restarts, you should be able to delete pagefile.sys file by going to its default location on a Windows computer – This PC > Local Drive (C:).

Note: You won’t be able to see pagefile.sys, if the option to “View Hidden System Files” is not enabled on the computer.
4. How to Restore Pagefile.sys?
If you are experiencing problems after deleting pagefile.sys, you can restore pagefile.sys back on your computer by using the following steps.
1. Open Run Command > type SystemPropertiesAdvanced and click on OK.

2. On System Properties screen, go to Advanced tab and click on Settings button, located under “Performance” section.

3. On Virtual Memory screen, make sure Automatically manage paging file size for all drives checkbox is selected.

4. Click on OK to close Virtual Memory screen and Restart the computer.
Once the computer restarts, you will see pagefile.sys file along with swapfile.sys file back on your computer.