Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: configure windows to QUICKLY delete pagefile on shutdown? (not wipe)

19 Mar 2018   #1
7point5

windows
 
 
configure windows to QUICKLY delete pagefile on shutdown? (not wipe)

so I just discovered what may be one of the dumbest design choices ever if this is true: when configuring windows to clear the pagefile on shutdown (by flipping the ClearPageFileAtShutdown value in registry to 1) windows actually overwrites the entire file (with zeroes probably)
so obviously when that file's several gigs then it takes several minutes to shutdown

anyone found a way to instead tell windows to simply delete it instead? (like users can do by right-clicking delete with the mouse or typing "del pagefile.sys" in command line)



PS. I wanna delete that damn file on shutdown not for security reasons but practicality: so that when backing up with Ghost I don't have to delete it manually (which isn't possible to do in command line outside windows anyway)

also I've read that starting windows without previous pagefile seems to slightly improve performance or something, dunno if that's true


My System SpecsSystem Spec
.
19 Mar 2018   #2
Ranger4

Windows 7 Home Premium 64 bit sp1
 
 

I might be wrong but I would think that Windows empties the Page file on shut down & this is often the reason shut down can be delayed.

A good back up program should not include the Page file as files in the Page file are going to vary all the time, so backing them up would seem futile.

Fiddling with the Page file will probably end up in tears as you really don't know what files are in it.
My System SpecsSystem Spec
20 Mar 2018   #3
LMiller7

Windows 7 Pro 64 bit
 
 

I very much doubt Microsoft would provide an option to delete the pagefile on shutdown. Raymond Chen, a Microsoft developer since Windows 95 days, would call this a security hole disguised as a feature.

From a security standpoint, which is the entire purpose of the registry setting, deleting the pagefile would serve no real purpose. As is quite well known recovering a deleted file that has not been overwritten is not particularly difficult. For any hacker wishing to access the pagefile this would be a mere speedbump. Overwriting the pagefile is the only way to provide the security the setting was designed to provide. Windows will not allow deleting the pagefile while it is running. That would almost certainly result in a system crash.

Yes, overwriting a large pagefile will take time. That is why it is not enabled by default. In a high security environment this might be a good idea but it makes little sense outside a comprehensive security policy. Most computers have security holes more serious than an uncleared pagefile. The setting has no other benefits.

Most disk imaging software will either provide an option to not copy the pagefile or will not do it at all. Macrium Reflect simply will not copy the pagefile or hibernation file in an image backup.
My System SpecsSystem Spec
.

18 May 2018   #4
alan1000

Windows 7 Home Premium 32 bit
 
 

There is a configuration which will achieve your object, and that is to set up a 'ramdisk' or 'virtual drive' in memory, and configure Windows to place the pagefile in the ramdisk (not on drive C).

You may need to instal more RAM to make this feasible. If you're using 32-bit Windows, you are limited to a total of 3.2Gb (usable), so you would configure the ramdisk to use no more than (say) 1.5Gb. Of course, if you are using 64-bit, the sky's the limit. There are some good freeware ramdisk drivers out there for download, but they are not all equally fast (or user-friendly to set up!), so you should do some googling for benchmarks and reviews before you make a final choice. Advantages of a ramdisk pagefile:

(1) Instantaneous response, because it's located in memory.

(2) It evaporates instantly when you shut down. A new blank pagefile is set up each time you boot Windows (this has no impact on boot time).

(3) Any malware which has established itself in the pagefile is flushed away on shutdown.

I know this is a tardy reply, but I've only just come across this thread!
My System SpecsSystem Spec
19 May 2018   #5
7point5

windows
 
 

1) is it true ramdisks use up an entire core of the CPU?

2) if pagefile is on a ramdisk what happens if I boot into safe mode will ramdisk still be there (and if not where will the pagefile be stored?)
My System SpecsSystem Spec
19 May 2018   #6
Barman58

Windows 10 Pro x64 x3, Ubuntu
 
 

If you have enough spare RAM to host the Swap File (Pagefile), it's far better to leave things well alone .

The pagefile will only be used if you run out of usable ram so a pagefile in RAM creates an Endless Causality loop.

as the default for the page file is 1.5 times the amount of installed RAM, it's an impossible task to have this stored in RAM, if you have enough ram to spare just reduce the size of the Pagefile to 256MB, (some programs expect the Pagefile to be present so it's detrimental to the system to set it to zero). Also if you are running an SSD or other Solid State Disks there is little access overhead for the traditional PageFile .

The whole concept of a ramdisk was to use spare ram to speed up operation of programs by using it as a fast disk. Modern SSD's are now cheaper and faster that the older HDDs which caused the problems and indeed they may be faster than the RAM in those days
My System SpecsSystem Spec
19 May 2018   #7
alan1000

Windows 7 Home Premium 32 bit
 
 

Quote   Quote: Originally Posted by 7point5 View Post
1) is it true ramdisks use up an entire core of the CPU?

2) if pagefile is on a ramdisk what happens if I boot into safe mode will ramdisk still be there (and if not where will the pagefile be stored?)
I've never heard that a ramdisk uses an entire core - I'm open to be corrected, but I would be very surprised if that's the case, because ramdisk works perfectly well with single-core processors. It's possible there are ramdisk drivers out there which try to sequester an entire core for themselves, if one is available, but I'm not aware of any. As for working in safe mode, I'm not in a position to test that at the moment, but it might depend on your system. Like any other system device, ramdisk works from a driver loaded at startup, so it depends whether safe mode considers it to be an essential driver or not. If the ramdisk fails to load, the pagefile will default to drive C.

With regard to SSD's, the pagefile is a very dynamic file which continually varies in size and content, so loading it into a ramdisk will significantly reduce wear and tear on the SSD.

In a 32-bit system with 3.2Gb usable RAM, I have always found that 1.5Gb is sufficient for the ramdisk, especially if the startup list is cleaned out to the essentials (which is something you should do whether you have a ramdisk or not, because it benefits your system in lots of ways, eg by speeding up boot time and reducing memory consumption).

The space needed by the pagefile is determined partly by available memory, but mainly according to the tasks you are performing, and I have found that it is generally well under 1Gb on any well-maintained system.
My System SpecsSystem Spec
19 May 2018   #8
LMiller7

Windows 7 Pro 64 bit
 
 

Quote:
1) is it true ramdisks use up an entire core of the CPU?
I can't see how this would be even possible. In Windows there is no provision for dedicating a core to a specific process or device driver. Affinity settings don't work that way. You can restrict a process to a single core but this is not exclusive. The thread scheduler can and will use this core for any other purpose it chooses, subject of course to other affinity restrictions.

Quote:
2) if pagefile is on a ramdisk what happens if I boot into safe mode will ramdisk still be there (and if not where will the pagefile be stored?)
Safe mode uses only a set of defined essential services and drivers, which the RAMDisk driver will not be among. If no other pagefile is defined and you boot into Safe mode you will have no pagefile. I am about 99% certain of this. I have no intentions of trying this.

As for putting the pagefile on a RAMDisk:

Creating a RAMDisk is usually a poor use of memory. Putting the pagefile on it is a particularly poor use of memory. The idea that it would be beneficial is primarily based on misconceptions of how the pagefile is used. To be sure there are many such misconceptions. Most descriptions I have seen regarding the pagefile are at least partly wrong. Even Microsoft user level documentation is very misleading.

Having the pagefile on a RAMDisk may benefit certain aspects of performance performance under some specific situations but it will take a hit elsewhere. On the whole it will cost performance.

The pagefile is simply a place where infrequently used data can be offloaded from RAM thus leaving more of it for more important uses. Putting the pagefile on a RAMDisk results in data being shuffled around from one location in memory to another with no real gains. Don't be fooled by the Task Manager memory gauge into thinking you have a lot of of unused memory. All memory except that labeled as Free is in use.

These views of having the pagefile on a RAMDisk are not just my own. They are sheared with many Windows experts whose knowledge and experience far exceed my own. And they have used far stronger language than I would care to use here.
My System SpecsSystem Spec
20 May 2018   #9
alan1000

Windows 7 Home Premium 32 bit
 
 

Last comments from me...

Unless you tell it to do otherwise, Windows will always initialise (and use) a pagefile on drive C, no matter how much memory is installed. It's an essential feature of the Windows design philosophy. If you configure a ramdisk pagefile, and it doesn't initialise, Windows will display a message to inform you that it's setting up a temporary pagefile on drive C.

I once heard that you can force Windows to retain the pagefile contents in volatile memory, without needing to use a separate ramdisk, by executing a runtime instruction. However, I can't find any reference to this on the web. All the discussion suggests it's either impossible or, at best, complex and tricky to set up.

If it could be set up, I'm not aware what the relative advantages and disadvantages might be, compared with a ramdisk. The configuration might be more likely to crash, because any failure such as a memory conflict, a runaway thread, or a simple memory overflow, would be uncontained and therefore potentially catastrophic. The problem might be contained, or not arise in the first place, if the guilty files were sequestered in a pagefile within a ramdisk; I suspect an overflowing ramdisk pagefile would simply spill over into drive C. But that's just my speculation.

The point about minimising wear to SSDs is especially relevant to computers which have the SSD soldered directly to the motherboard. Out of warranty, in the event of a breakdown, these are not economically replaceable and the data will probably be unrecoverable, so you would naturally want to maximise life expectancy.
My System SpecsSystem Spec
21 May 2018   #10
Snick

Win 10 x64, Linux Lite, Win 7 x64, BlackArch, Kali, VMWare Workstation Player, OpenVPN
 
 

My System SpecsSystem Spec
Reply

 configure windows to QUICKLY delete pagefile on shutdown? (not wipe)




Thread Tools




Similar help and support threads
Thread Forum
Can I delete pagefile.sys?
I have a file on my ssd called pagefile.sys it is taking up 16gb on my ssd I wanna know if it would be troublesome to delete it? I know that when my ram is full windows stores data in this file however if I delete it to get the disk space back will windows just create another one and restart the...
General Discussion
Quickly delete thousands of large files
I have a folder, and it has ~35,000 files in it, totaling about 90gb.. Is there any way for me to delete them all, permanently, and quickly? It takes 10seconds to 1min just to right click delete. I don't need them, I don't want them to go to the recycle bin, I just want them unlisted so I can...
Performance & Maintenance
PageFile.sys & Hiberfil.sys - Delete Safe?
Hello SF, I just do a drive clean-up (Deleting some junk files to free some space on my HDD) I managed to see the HD stats what files did takes a lot of space in it using WinDirStat app... I removed some games that I no longer played in a while and some backup files that already made a...
Performance & Maintenance
Does disabling pagefile.sys delete it from the system?
For security reasons, I want to delete the contents stored inside pagefile.sys securely with very slim chance of recovering it. I thought about backing up my files and doing a reformat of my PC and then using Eraser to wipe free space. But this is a time-consuming method. What is the fastest way to...
General Discussion
Possible to configure 7 to auto-wipe files?
Hello folks, I'm in the process of transitioning to Windows 7 and exploring the new capabilities that come with it. One feature I've long wondered about and considered potentially useful (but never actually ran into in the real world) is a OS/filesystem option which if enabled would cause the...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 15:50.
Twitter Facebook Google+