Jump to content

Delete (Not clear) Pagefile at Shutdown.


Recommended Posts

Posted

We all know that you can ClearPagefileAtShutdown by either modifying the registry or setting the ClearPagefileAtShutdown in Security options.

But this takes time as the system writes zeros to the pagefile.

Is it possible to completely DELETE the pagefile, in less than one second, so that it can be re-created when the system re-starts?

Batch file maybe?

DEL C:\pagefile.sys ???

But how would you activate it?


Posted

Case in point (I personally don't want to test an AFAICR) -

Clearing it will take just as much time as rebuilding it at startup.

Not swearing to it, because I DON'T want to reboot to my XP right now (have deleted PageFile on it's partition).

You would still be "writing" to it (Shutdown or Startup, whichever).

As jaclaz stated, this will probably work. However, note this in the VBS -

"ERROR: The paging file from volume '%1' cannot be deleted."

" At least one paging file must be present."

SO... it implies that you will have to do a "resize" at the least (to ANOTHER volume) and probably boot twice to "reset" it back to the original.

If your intent is to "defrag" it (force it to be contiguous), the best way (IMHO) would be to redefine it on another partition, reboot, defrag the Volume where it USED to be, then, "redefine" it back (it will be "recreated" on reboot). Note the MFT will still cause potential "contig" probs for the PageFile (MFT will not be affected and could "break" Pagefile into minimum two).

Open to massive corrections by others...

Posted

Case in point (I personally don't want to test an AFAICR) -

Clearing it will take just as much time as rebuilding it at startup.

Not swearing to it, because I DON'T want to reboot to my XP right now (have deleted PageFile on it's partition).

AFAICR ;) the pagefile is created (if missing) at startup with a mechanism similar to using FSUTIL (on NTFS), thus it should be very quick. :unsure:

jaclaz

Posted (edited)

Well, I'm not so sure that a PageFile can be deleted OR resized to "zero" on a Running System. It would have to (AFAIK) be deleted "offline" from an (e.g) WinPE. Hence my statement "have deleted PageFile on it's partition". To clarify, I have done this while running ANOTHER O.S. running on ANOTHER partition that's using a DIFFERENT PageFile (dual-boot).

LiveXP, WinPE, LiveLinux, Dual-Boot ANY other OS that can delete from FAT32 (and/or NTFS) that is NOT "using" the one to be deleted in order to delete it. (???).

1 - Boot to Something Else

2 - Delete PageFile-Of-OS-In-Question

3 - Reboot to What-I-Wanted-To-Delete's-OS

4 - "Rebuilt"

Which methods would be faster? Dunno... Still appears to be a "reboot to something" issue...

Edited by submix8c
Posted

t would have to (AFAIK) be deleted "offline" from an (e.g) WinPE.

Like chkdsk on the system disk or programs like "PageDefrag", it can still be performed at reboot while Windows load, so no need to reboot twice ("offline" then "online").

Posted

"Pagefileconfig.vbs seems like a more suitable choice."

Copied it from this machine after reading your reply just in case it is not present on mine.

If I set up a second pagefile on a partition, then I can delete one or the other.

Posted (edited)
Like chkdsk on the system disk or programs like "PageDefrag", it can still be performed at reboot while Windows load, so no need to reboot twice ("offline" then "online").
Still requires a method of "deleting" before "auto-recreating", true?

I suppose you could initiate a "chkdsk", then "offline" find the Reg Entry(?), then use that as a sample for a "CMD" to execute?

I'm not really into trying this out. I see no other alternatives. It MUST be deleted SOMEWHERE while the OS has NOT been loaded to the point of CREATING the Pagefile! True or not??? ("Offline" no matter how you want to slice-and-dice the "terminology".)

edit - I have no need for such a function, hence the "trying" comment.

Edited by submix8c
Posted

AFAIK the Group Policy is still "clear" (and NOT "delete") see:

You can set a GPO to run a program or script at logoff, but I guess it doesn't matter if you can't delete it from a running OS.

Posted

You can set a GPO to run a program or script at logoff, but I guess it doesn't matter if you can't delete it from a running OS.

Are you sure you can't delete it?

One should be able to at-least resize it to something like 70÷120 Mb:

and then clear this latter.

How long will it take?

How long will re-creating/expanding it at next boot?

Somehow I feel that another possibility could be to move it's physical location in the Registry :unsure::

http://www.annoyances.org/exec/forum/winxp/t1040090780

or add a new pagefile on another volume.

Quick test (just made).

Starting from a 500-500 pagefile.sys on C: (%Systemdrive%), created through the normal GUI a new 100-100 pagefile.sys on D; and removed the one on C:

You must reboot for these changes to take effect, bla, bla, bla....

Instead of rebooting, ran Unlocker on the C:\pagefile.sys and Unlocked it (at it went "poof" ;)).

jaclaz

Posted
Starting from a 500-500 pagefile.sys on C: (%Systemdrive%), created through the normal GUI a new 100-100 pagefile.sys on D; and removed the one on C:

...

Instead of rebooting, ran Unlocker on the C:\pagefile.sys and Unlocked it (at it went "poof").

But... now you have one on D-Drive? :blink:

That "other MSFN topic" you were looking at seems a potentially more viable option... (been watching...)

Posted

But... now you have one on D-Drive? :blink:

Sure but it is 1/5 of the original and it will take roughly 1/5 of the time to be cleared.

Since on this machine I have more than 2 gb of RAM and currently the pagefile is not in use (I am "peeking at around 700 Mb of used memory), I can allright delete the pagefile (on whichever drive it is), this is actually what I have done while I am typing this post.

The "vanishing" is "immediate".

I cannot for a number of reasons reboot right now, so I have no idea what will happen then (if a pagefile will be created at all, if it will be created with the "windows managed settings, whatever).

Please let us not transform this otherwise peaceful thread in the usual "Windows can run without a pagefile vs. No, you d@mn id*** it cannot", or of the "You better leave pagefile managed by windows vs. "NO, it should be 1.5 to 2.0 x your RAM size", "Godzilla vs. King Kong" (and YES, the dinosaur can kick that grown up chimpanzee's @ss all the way to the moon and back with BOTH hands tied behind it's back ;)).

jaclaz

Posted

you can't delete it when Windows runs. Windows can only add a new pagefile when it runs, but you can't remove it.

Well, then I managed to just do something impossible. :w00t::ph34r:

jaclaz

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...