Is it possible to delete the swapfile swp. Complete customization of the Windows paging file. Where is the swap file

This article explains the purpose of the swap file, the benefits of placing it on a different physical drive, and provides step-by-step instructions for moving it in Windows.

A note about links in this article

The first version of the material was written a very long time ago, and during this time the pages of Microsoft sites have changed or disappeared altogether. You can view their previous content using the Internet archive, although in the Russian Federation it is Roskomnadzor. Since there are no current pages with this information, I decided to leave the links "as is".

Next in the program

What is a swap file and what does moving it do

According to Windows Vista help, where the paging file is called a page file, this is a hidden file or files on a hard disk used by Windows to store portions of programs and data files that can't fit in RAM. The page file and physical memory or random access memory (RAM) make up virtual memory. Windows moves data from the page file to RAM and from RAM to the page file as needed to make room for new data. Also called swap file.

Placing the paging file on a partition specially designated for it another physical disk improves Windows performance by speeding up the processing of input/output (I/O) requests. In addition, the file placed in this way is not fragmented, which also improves performance.

How many swap files should there be and where to place them

There is an article in the Microsoft Knowledge Base (KB307886) that talks about how to move the paging file in Windows XP (no newer ones have been published). Specifically, the article states that you you can increase system performance and also free up space on the boot partition by moving this file to an alternate partition. Unfortunately, the article does not cover one important point.

It makes sense to move the paging file only to a partition located on another physical disk, which I have already mentioned twice in this article.

This, however, is discussed in another article (KB314482), which provides the rationale and benefits of this approach, as well as other tips for setting up the page file. For example, it says that if there is no paging file on the system partition, Windows will not be able to create memory dumps (memory.dmp), which can be useful for troubleshooting the OS. I recommend that you read this article to better understand the benefits of moving the swap file.

As for placing the paging file on another partition of the physical disk on which the operating system is installed, this approach, although it avoids fragmentation of the paging file, does not lead to faster processing of I / O requests, which is much more important for improving OS performance, than a defragmented swap file. In Windows XP, with one physical hard drive, it was enough to organize a defragmentation of the paging file using the PageDefrag utility, but in newer OSes it does not work.

If you have two or more physical disks, according to Microsoft recommendations, it is optimal to create multiple paging files - on the system partition (in fact, to preserve the ability to write memory dumps) and on other physical disks (to increase performance by speeding up I / O operations).

Having several paging files at its disposal, the system itself chooses the fastest option. Therefore, in a bunch of SSD + HDD, two FPs are useful only when the SSD is loaded with work to the eyeballs. But with a pair of SSDs, two FPs might well make sense, and that's exactly what I've done.

How big should the swap file partition be?

Since the gain from defragmenting the FP is negligible, it can be ignored and not create a separate partition for the FP (this is definitely not required when placing the second FP on an SSD). In any case, there can be no specific recommendations on the maximum size of the paging file, since everything depends both on the amount of installed RAM and on how intensively the paging file is used by the system and applications.

Obviously, the more RAM installed, the less swap file is used. When the size of the page file is managed by the system, its maximum size is no more than three times the amount of RAM. In most cases, a partition with this size will be sufficient. Increasing the paging file unnecessarily will not increase performance - this will not make the system use it more actively.

How to move the swap file

Conclusion

This article provides recommendations for configuring the paging file to improve the performance of Windows Vista and newer. In particular, the issue of moving the paging file to a separate partition of another physical disk is considered, and step-by-step instructions are provided explaining how to do this.

You can find answers to other questions about the swap file in the OSZone forum thread. In particular, it says how big should the swap file be, is it possible to work without a swap file and is it good etc.

It tells how to determine the optimal size of the paging file, what to do with SSD drives and how to set the file size on Windows 7, 8 and 10 (as well as XP and Server - the steps are almost identical).

This article covers the following steps for pagefile.sys(as well as swapfile.sys in later versions of Windows): defrag, migrate, shutdown, and cleanup. Does it make sense to create several paging files on Windows, on which drives it is better to place them and what all this can lead to in terms of improving system performance.

Location and visibility of swap files

By default, the swap files pagefile.sys and swapfile.sys are located in the root of the disk where Windows itself is located (all system folders). Since pagefile.sys is a hidden system file, it is invisible by default: you need to enable show hidden files and folders. In Windows 7, the display of hidden files and folders can be configured in the Control Panel.

Enabling invisible (hidden) files and folders in Windows 7:

  1. Push button Start.
  2. Go to Control Panel, then to the section Decoration and personalization.
  3. Select "Folder Options" -> "View" -> "Advanced Options".
  4. Select "Show hidden files, folders and drives".
  5. Click OK to save changes and exit the menu.

AT Windows 10 You can enable the display of hidden files and folders in Explorer:

  1. In the top menu of the explorer, go to the tab View.
  2. Select section Options, in the window that opens, open the tab again View.
  3. Open "Advanced Options" and uncheck the "Hide protected operating system files" checkbox.
  4. Check the box next to "Show hidden files".
  5. Click "Apply", then "OK" to save the changes.

The Folder Options menu should look something like this:

Completely disable pagefile.sys and swapfile.sys

The question of the need to completely disable paging files equally often worries Windows 7 and 10 users when there is a high-speed or sufficient amount of RAM (RAM). In the article about it has already been clarified that it does not make sense to completely disable it.

Reasons not to completely disable sfop (paging):

  1. Some programs and games, and even Windows itself, are designed to work with the paging file; without it, unexpected errors and glitches may appear.
  2. With enough RAM (8-16 GB or more, depending on tasks), 300-500 MB of data will be written to pagefile.sys per day. In other words, the user does not sacrifice anything.
  3. With enough RAM, you can set a file size limit of 1 GB and not worry about it in the future.

If the desire to turn off the paging file has not disappeared, in Windows 10 it is done like this:

  1. Right click menu Start, select item System.
  2. In the left menu, click "Advanced system settings" (you need to have administrator rights).
  3. Click Options, open tab Additionally.
  4. In the "Virtual memory" window, click on the button Change…
  5. Select a line below No swap file.
  6. Click Ask, then Yes in the warning window that appears.
  7. Click OK in the Virtual Memory settings window to save changes.

All changes will take effect after you restart your computer. Just in case, you can check if pagefile.sys has really been deleted and is missing from the root of the system. If in the future any game or program requires this file or starts to give errors about the lack of virtual memory, you can turn the pagefile back on the same menu.

AT Windows 7 and Windows 8/8.1 To change or delete the swap file you need:

  1. Right-click on the My Computer icon on the desktop, select Properties.
  2. Select "Advanced system settings" from the left menu.
  3. Go to the "Advanced" tab at the top of the window.
  4. In chapter Performance click on the button Options.
  5. Go to the "Advanced" tab again. In the "Virtual Memory" section of the window, it will say what the maximum size the paging file can occupy at the moment.
  6. By default, these versions of Windows set the size of the pagefile to be equal to the RAM. Click Change to set other values.
  7. Uncheck the box "Automatically choose the size of the paging file."
  8. Select item No swap file to turn it off completely.
  9. Click OK and restart your computer for the changes to take effect.

As already stated, Windows 7/8 does not work very well without a pagefile.sys file in the system. It is better to leave the swap size 512-1024 megabytes for system purposes. This rule works regardless of the amount of RAM on the computer.

Migration and defragmentation (breakdown)

Transferring a paging file from one disk to another is performed on the same page, where the file size is selected and paging is turned on / off. You can select any of the drives connected to the system, including SSDs. The changes will take effect after a reboot: Windows will create a new file on the specified drive when the system starts.

Interestingly, on the official Microsoft website there is only about transferring the paging file. The article contains instructions for Windows XP, no new information was added on this topic.

The instructions below will help move pagefile.sys to another drive in Windows 7, 8/8.1 and 10:

  1. Right-click on the My Computer icon on the desktop, go to Properties.
  2. Select "Advanced system settings" on the left, then go to the "Advanced" section.
  3. In chapter Virtual Memory press the button Change(at the same time, you can set the optimal file size, focusing on the suggestions of Windows and).
  4. Uncheck the box "Automatically choose the size of the paging file", if it was checked there.
  5. Listed Drive [volume label] select disk, select below Specify size and set the file size in megabytes.
  6. Click Ask and OK to save changes. Click OK in the system message window, if it appears.

You can select several disks at once and set a different size for swapping in each of them. In this case, there will be several pagefile.sys documents that Windiws will use as it sees fit. For the average user, it makes no sense to perform splitting. Defragmenting the paging file into several separate files will not speed up the system and will not give any performance gain.

In some cases, a file of the minimum size is still needed on the system disk, and not on a high-speed SSD or flash. This allows you to save the ability to diagnose the system when critical errors (BSOD) occur, since debugging data can be written there.

A file split across several disks will look like this:

Swap file on flash drive

Separately, I would like to mention such a practice as transferring the swap file to a USB flash drive. Firstly, it is quite problematic to do this, since Windows will not list removable storage media in the list of disks for the paging file. Secondly, even if you still succeed in transferring pagefile.sys to a USB flash drive, this may not give any significant result.

On the one hand, the speed of USB 3.0 is really high, especially when compared with HDD:

  • USB 2.0 - up to 480 Mbps (60 Mbps)
  • USB 3.0 - up to 5 Gb/s (600 MB/s)
  • SATA Revision 2.0 - up to 3Gb/s
  • SATA Revision 3.0 - up to 6Gb/s

In reality, not every flash drive works even at maximum USB 2.0 speeds, not to mention 3.0. From a regular flash drive in such a situation, it will be possible to get a write / read speed of 30-100 Mb / s or even less. Compared to HDDs, not to mention SSDs, such speeds will not give any performance gain.

Clearing the contents of the swap file

When you turn off your computer, Windows erases all data that is in random access memory (RAM). Data from the paging file is not erased by default and remains on the hard disk when the system is turned off. Therefore, in some situations, third parties can access the information in this file.

For security purposes, you can force Windows to delete all the contents of pagefile.sys by overwriting all memory locations with zeros. In this case, potential attackers will not be able to get to important documents. At the same time, the owner himself will not be able to access information from the swap, including the information necessary for debugging.

There are two ways to force Windows to clear the contents of the swap file:

  • Using the settings Group Policy Editor.
  • By changing the value of the entries in Windows Registry Editor.

You should not climb into the Registry Editor without unnecessary need, especially if you have no experience with this section of the system. First, you should try to enable file cleanup using the instructions for Group Policy Editor.

This method only works for owners of Pro or Enterprise versions of Windows:

  1. Click Start, in the search bar enter gpedit.msc and open the file.
  2. In the Group Policy Editor that opens, go to the section Computer configuration, then in Windows configuration.
  3. Open Security > Local Policies > Settings on the left side of the window.
  4. On the right side of the panel, double click on the policy Shutdown: Clearing the virtual memory paging file.
  5. In the window that opens, select the item Turn on.
  6. Click OK to save changes. Changes will take effect after a system reboot.

If something went wrong, you can use Registry Editor:

  1. Click "Start", then "Run". In the window that appears, enter regedit and press the Enter button.
  2. In the registry editor that opens, find the key (on the left side of the window): HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager\ Memory Management.
  3. Right-click in any free space on the right side of the window, select from the context menu New -> DWORD Value (32 bits).
  4. The new parameter must be named ClearPageFileAtShutdown.
  5. Double-click on the created parameter, in the window that opens, enter 1 in field Value, click OK to save the changes.

The finished work should look like this:

You must restart your computer for the changes to take effect. Windows will then clean up the contents of pagefile.sys each time the system is shut down. To disable clearing the paging file, you need to set the generated parameter ClearPageFileAtShutdown to 0 , or simply remove it from the registry. After removal (RMB -> Delete) Windows will restore the default value (no cleanup on shutdown).

Let's separate the files Swapfile.sys Hiberfil.sys Pagefile.sys on the sides: what and what does it serve, what function do they carry, and what role do they play in the performance of your computer?

Swapfile.sys Hiberfil.sys Pagefile.sys: one extra?

In the Windows operating system, the lack of system resources is actively supported. The system accesses it (if it is created) at the moment when the RAM ceases to cope with the tasks set, or rather, redistribute RAM resources.

In addition, Windows is set by default, which allows you to save all “core” processes (from the Windows kernel side), as well as those launched from the side, directly to the hard disk. After pressing the computer's start button, this file helps the system boot faster than with a normal boot from scratch. The file is called hiberfil.sys.

______________________________________________________________

It would seem that everything is simple and clear. However, with the advent of Windows 8/10, the situation has become a little more complicated.

And pagefile and hiberfil are registered firmly in the system while the paging file and fast startup functions are activated:

But, as you can see from the last picture, the hibernation mode (and therefore the file itself) is firmly tied to: no quick start - hibernation does not work. Although the file hiberfil will remain in place until you forcefully get rid of it (command in the paragraph below). And just like that with fast start for Windows 10 users there are constant problems: it is the cause of many system bugs ( File Explorer loses navigation functions, taskbar does not work, etc.).

Further. If a set all the settings of the specified and functions by default, a characteristic fact is observed: hiberfil takes 70-75% RAM, and pagefile get the rest 25-30% . Apparently, the hibernation mode requires a lot of resources to unload kernel drivers and applications, but the system takes these resources from the swap file. Delete hiberfil.sys(for this purpose, in the command console, enter the command

powercfg.exe -h off

the file should disappear) and look after a while at the swap file. Its value chosen by Windows will approximate the size of physical RAM. However, it all depends on the actual amount of RAM: the lower the amount, the larger the virtual machine will be in percentage terms.

pagefile grows larger after disabling fast startup and virtual memory autotuning

And what about in the end?

What is the conclusion from this? Unless you are a laptop user who is constantly at risk of losing data due to a dead battery, it is better to abandon hibernation in favor of a swap file, which is much more useful. In any case, remember about the distribution of computer / laptop resources when the quick launch function is activated: it consumes a lot of resources. Only the owners of “top” assemblies can boast of its trouble-free operation.

And here swapfile.sys?

With the first two, the situation more or less cleared up. What is swapfile.sys? Its function is similar to the paging file, but the action was originally directed to applications from the Windows Store. But not only. And despite the similarity in purpose, they have different algorithms.

During a session, Windows “means” both files: pagefile and swapfile. And the first contains information about programs that a long time ago user did not start and which can be “taken to the warehouse” – we can only regulate its dimensions. And in the second - information about the applications that exactly not enough RAM. Do you feel the difference? With all that, both files work differently on different assemblies: pagefile has proven itself on productive machines, the second one should more often be included in the work on aging computers or tablets running Windows. And don't forget that both files are primarily hard disk space. This means that both are subject to fragmentation, and this process is almost instantaneous, and the huge allocated sizes for files can gradually disappear due to fragmentation. What is described is the starting point for solving problems with performance and .

Swapfile.sys Hiberfil.sys Pagefile.sys: Conclusions

We found out that Swapfile.sys Hiberfil.sys Pagefile.sys play an undeniable role in system performance. However, each of them performs its function in its own way, which depends on the state of the system as a whole and the hardware capabilities of the computer. So remember - the exposed functions for optimizing Windows may not work or may not work at full capacity. Keep the system in good condition.

In this article, we will talk about such a curious file as Swapfile.sys. This material will be of interest to those who like to study what certain operating system files are for, whether they are of any importance and whether they can be deleted. Well, now let's sort it out in order.

Where is Swapfile.sys

It is located in the root of the system disk (in some cases, it may be located on other sections of the hard disk, depending on where your paging file is located). The fact is that Swapfile.sys is nothing more than a swap file. Only in the Windows 7 operating system, one pagefile.sys file was responsible for virtual memory, in the top ten, Swapfile.sys was also added to it.

Since this is a system file, you just won’t see it if you go to the root of drive C:

In order to see Swapfile.sys, we need to enable the display of system files. To do this, right in the explorer window, click on the "File" tab and from the drop-down menu select "Change folder and search options".

In the window that opens, go to the "View" tab and remove the bird in front of the item "Hide protected system files".

And here is our file.

Now about whether it is possible to remove it and how best to do it. I have already written about the paging file in Windows 10. Therefore, read and, depending on the parameters of your computer, decide whether to disable it or not, and here I will simply duplicate how the paging file and, accordingly, Swapfile.sys are deleted.

And so, right-click on the icon " This computer»And from the drop-down menu select the item"Properties"

In the window that opens, select "Advanced system settings":

In the window that opens, remove the bird in front of the item "Automatically choose swap file size"

Select the hard disk partition where the file is installed, put the switch in the position "No paging file" and click on the button "Set" and "OK"

Everything, after that Swapfile.sys will be deleted from the computer and disk space will be freed up.

And also watch a video on the topic:

Rate article:

10 facts about swapfile.sys - What is this file and can it be deleted

Owners of Windows operating systems from 8.1 and higher may have noticed that the list of system files has been supplemented with one more - .

What this file is responsible for and whether it is needed in the system, all PC users need to know.

What is swap file?

In addition to pagefile.sys, the Resource Monitor has swapfile.sys.

These are all swap files and are used exclusively for metro apps.

By default, such files are stored in the root folder of the hard drive and do not exceed 256 MB in size.

At the request of the user, the amount of memory of the swap file can be increased.

Why did the system have a third paging file?

The need for the third file arose after a new way of managing memory was required due to the emergence of a large number of applications with the Metro interface.

Such applications require a little more memory for their work.

To see the swap file, you first need to enable the display of protected system files.

You can display them like this: Control Panel - Folder Options.

In the folder options, find the tab "View" and open it, remove the marker from the item and save the settings by pressing the OK button.

When there is not enough RAM while applications are running, the system automatically writes data to swapfile.sys.

Thus, it became possible to suspend inactive applications to unload "operatives".

Restoration of applications occurs automatically after the release of RAM.

How does swapfile work?

The work of the swap file can be disassembled in stages:

1. PLM (Process Lifetime Manager - Lifecycle Manager) calculates the amount of missing virtual memory and sends a request to MM (Memory Manager - Memory Manager) to release the working set of one of the processes that is responsible for processing Metro applications.

2. The memory manager processes the request, then instructs it to move the memory page to the list of recent operating system change pages.

All page content is automatically copied and saved to disk.

3. The set of pages is written in turn to the modified list page as indicated by MM.

Recording is done in the background and only triggers when there is not enough virtual memory.

4. After updating the application, the worklist is downloaded to the hard drive.

Those memory pages that were removed from the process will still remain untouched in the waiting list.

In another way, we can say that they remained in the cache of useful pages, which, if necessary, can be used for other applications.

If the memory pages are required by the "native" application, the system can quickly return them.

Where is the swap file located?

You can find it in the root folder of the hard drive where the operating system is installed.

Most system files are protected and hidden.

Therefore, to find it, you need to display all hidden system files.

You can configure the display of hidden files not only in the way that we described above. There is one more option.

To do this, go to the root folder of the hard drive and open the menu in the upper left corner "File", in which you need to select an item "Change folder and search options".

In the window that opens, open the tab "View", uncheck the box "Hide protected system files" and save the changes by pressing the Apply and OK buttons.

After that, not only the swap file swapfile.sys, but also other important system files will be displayed in the root folder.

Under no circumstances should you delete such files! This is fraught with the risk of breakage for your computer system. Otherwise, you will have to reinstall the operating system completely.

Difference and belonging

Actually swapfile is analogous to pagefile. Both of them are used for temporary storage of application data, offloading RAM.

What distinguishes them from other files with the .SYS extension is the high responsiveness of the applications stored in the swap and page files.

Customization options

If necessary, the user is given the opportunity to change the amount of available space, disable or delete the swap file, and also transfer it to another hard drive.

However, you can only change or delete it at the same time as the pagefile.

By default, the system has the function of automatically launching the file and allocating memory for them on the hard disk.

If the user does not agree with the standard settings, he is given the opportunity to change them.

How to change the amount of virtual memory

There are several ways to change the amount of virtual memory:

  • Menu "Start" - "System" - "Advanced system settings".
  • In the menu search bar "Start" enter "Performance"(without quotes).
  • Menu "My Computer" - "Properties" - "Advanced system settings".

Opening settings through the search bar requires fewer steps than using other methods.

In the window that opens, go to the tab "Additionally", then LMB click the Edit button.

If you have not made any changes to the system's virtual memory settings before, the new window will have a marker on the item.

If you remove this marker, you can independently change the size of the allowed memory at will.

To do this, manually enter the allowed volume, then click the Set button.

Disabling virtual memory

It is impossible to remove the swap file completely from the computer, but you can disable it until the moment when there is no need to expand the OP.

In the window for changing virtual memory parameters, put a marker on the item "No paging file", confirm the action by pressing the Set and OK buttons, and then restart the computer system.

It is worth noting that the amount of free memory on the hard drive will increase, and the performance of the operating system may be significantly reduced.

To restore the swapfile, you need to go to the same parameters window and put a marker on the item "Automatically choose swap file size", or set the virtual memory size, then reboot the system.

After a restart, the paging file will be restored.

Move swapfile to another hard drive

You can also customize the swap file by transferring it to another hard drive.

In this case, it is a different hard drive that is meant, and not a logical partition of the same disk.

Transferring a swap file saves disk space with the system, but performance does not change.

To transfer, you need to make a symbolic link.

Mklink c:\\swapfile.sys g:\\swapfile.sys

Instead of the letter g, you can put any other that corresponds to the disk you need.

After all the manipulations performed, it is required to reboot the operating system.

Determining the optimal amount of virtual memory

Before changing the amount of virtual memory, you should consider why you are increasing the performance of your computer.

If this is an office PC or a laptop for work, you should not increase the memory too much.

For a gaming computer, consider the amount of memory of the hard drive itself.

To determine the optimal amount of memory, run several priority programs, games and / or videos on the computer at once.

By pressing the Ctrl+Alt+Delete keys at the same time, call the task manager and go to the tab "Performance".

In this window, you need to find out how much RAM is loaded, then multiply this number by 2 and subtract the amount of memory actually installed.

For example, you have 5 GB of RAM loaded and 6 GB actually installed. We calculate: (5+5)-6=4 .

Exactly this amount of additional virtual memory will be optimal for your computer.

Checking swapfile after disconnect

After you have disabled the paging file, you can check if it has disappeared from the computer system.

To do this, you first need to enable the display of all hidden system files.

To display, open the explorer and follow the following path: "File" - "Change folder and search options" - "View" - "Hide protected system files".

Save the changes by pressing the Apply and OK buttons.

If you disabled the swap file correctly, it will not show up in the system folder.

Check for a swap file

Advantages and disadvantages of Swapfile

Advantages:

  • Budget Savings. Thanks to the swap file, you can do without buying additional RAM cards for some time. If the extension is required for a certain time, you can use swapfile.sys.
  • Performance Stability. The lack of RAM greatly slows down the system, which definitely causes crashes. If there is enough memory on the hard disk, you can expand the virtual memory to the optimal amount.
  • Great temporary solution. If you do not have enough RAM to run demanding programs, the swapfile.sys extension will provide you with the temporary support you need.

Flaws:

  • Slow reading speed. If the swap file is not placed on the system hard disk, the response time may increase.
  • Swapfile is just RAM support. Swap will not be able to replace or supplement it fully.
  • Hard disk space consumption. If there is not enough free space on the hard drive, the swap will not help much in solving problems of lack of RAM. You will have to buy a new OP anyway.
  • High chance of computer crash. With the constant use of the swap file as an extension of the OP, a system failure may occur, because of this, your computer may need to reinstall the operating system or complex repairs.

conclusions

Allows you to temporarily expand the amount of RAM, but does not solve the problem of lack of available space properly.

Swap can only be used as a temporary solution.

At the same time, there is a danger of a BIOS error appearing, since this is a software “overclocking” of the computer, which is not initially provided for by operating systems.

For gaming computers, such a solution is not only useless, but also dangerous, since these computers use the system resources of their devices to the limit.

Using a swap file can lead to both incorrect operation and failure of your PC hardware.

If you doubt your skills, contact the service center, where specialists will help you sort out your problem, as well as advise you or independently configure your computer system.

Contact only licensed service centers that have good reviews or work at computer stores.